Please see my other Web Development articles.
Ensuring Separation of Concerns
When refactoring a web application, the following table represents a high-level overview of technologies/tools and the appropriate use of each, along with examples of how their boundaries for us may be violated.
Keep in mind for each tool is intended boundary and look for example violations when seeking areas to improve your application through refactoring.
|HTML||Client markup/UI layer||HTML mixed with the Database query results, combining presentation markup and data storage together, hindering reuse.|
|CSS||Client styling/layout/UI layer||CSS inline within HTML, limiting reuse, increasing maintenance costs (duplicates), mixes semantic markup & styling, prevents caching, reuse.|
|C#||Server logic/middle layer|
|SQL||Data access/data layer||SQL mixed with C# to make dynamic SQL. Use LINQ instead.|
In addition, using each technology within its boundaries provides the following examples of benefits:
- Keyword-formatting & Syntax validation: Each language maintained in their native files allowed the IDE (Visual Studio) format keywords for helpful display and provide valuable design-time validation to avoid bugs before code use.
- Separation of Concerns: Language files being maintained separately allows developers to more quickly isolate bugs and apply fixes, and aid in productivity/collaboration as specific development tasks may target specific files, avoiding having to change other files being changed by other developers.
- Code Reuse: Each language maintained in their native files allows OOP techniques to provide resuse of common behavior.