The goal here is for me to give some broad direction as to how to develop an Asp.net application. These tips will not tell you how to build an application or how to achieve certain functionality. That is up to the developer. The only goal here is guidance.
In complex system the data model is varied. There’s lots of common data across multiple classes, and there’s lots of variations on the same theme. How do you tackle this problem? This is the gospel truth, but I’ve found a way to mitigate class bloat to some degree.
User interfaces for common data items. Multiple classes may need locking flags. Create an interface called ILockable. Multiple classes may need to keep track of what project it relates to. Create a class called IProjectResident.
User interfaces for common functionality. You’re going to have several objects, for example, that correspond to an entry in a database table. An interface called IDatabase would contain methods for setting up queries for that object.
Create standard base classes. Every data model has common functionality and data that is shared across a large number of classes. Defining those such classes will make code more maintainable and will reduce the repetition of code.
Use a pattern of interface, abstract class, and specific class instance. First creating an interfaces that define high level properties and methods. Next, create abstract classes that define baseline implementations for each of those interfaces. Finally, create an implementation, extending the appropriate abstract class, of each version of each interface.
Use C#’s multiple inheritance. An interface and a class can have multiple interfaces, so multiple functionality and data combinations can be formed. This ability, again, makes code more maintainable, and it reduces code that is repeated.
The interface is where the money is made on the website. The UI provides the functionality that the customer demands. What separates good sites from bad sites is how that functionality works, how maintainable it is, and how extensible it is. All of that stems directly from how well the UI is designed.
Understand the technologies involved. Asp.net, for example, allows events, for a page and controls, to be processed on the server side. Processing all events using postbacks to the server degrades performance. A technology like AJAX, for example, allows communication with the server without doing postbacks, which helps to improve page performance. The point is not review, in an exhaustive list, every technology and what each is good for. The point is that designing a good UI involves understanding what technology exists and where each should and shouldn’t be used.
Develop a UI model. The temptation is to simply embed the standard controls and give them server side events. Baseline control classes, for both user controls and web controls, should be created. Common functionality can be centralized to improve maintainability and reduce repeated. Basic extensions of each standard control type could also be created. Logic specific to your controls can be created. Specialized versions of each extended control should be created for different situations. This allows a robust and varied UI.
Template your pages. The layout of pages should follow consistent patterns. One general pattern can be developed and then specialized for each type of page. This helps with maintainability. The UI modeled described above can be used to achieve this.
These tips come from my experience as an Asp.net developer. Certainly there are many tips that could be included here. These are the ones that come most readily to mind. Good luck with your development, and I hope that these tips have been helpful.
About Author: King of Mountain, just kidding, His name is Collin Rusk. He completed his Graduation from Le Moyne College 2005 on Management Information Systems with a minor in Computer Science. He worked for Flagstar Bank from 2005 to 2009 as a front-end developer. Now he is working at NetCSD Lead developer and architect focusing on Asp.net applications. Currently working on modernizing the company’s software framework. He loves video games, board games, reading about politics and economics and history.