Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Design Patterns for ASP.NET Developers, Part 1: Basic Patterns

Most Design Pattern documentation targets desktop applications or discusses pattern theory, but in this series you'll find a discussion and examples of patterns specifically targeted at ASP.NET.


advertisement

For the past year or so, I've been involved in documenting frameworks that help developers write better code, and create applications that are more efficient and easier to test, debug, maintain, and extend. During that time, it has been interesting to see the continuing development of best-practice techniques and tools at one of the leading software companies in our industry. Most of the work was outside my usual sphere of ASP.NET and web development, concentrating mainly on Windows Forms applications built using .NET 2.0. This is an area where standard design patterns that have evolved over many years are increasingly being refined and put into practice.

However, I regularly found myself wondering just how many of these patterns are equally applicable and advantageous within ASP.NET applications, where we now have the ability to write "real code" in .NET languages such as Visual Basic .NET and C# -- rather than the awkward mix of script and COM components upon which classic ASP depended. Surely, out of the 250+ patterns listed on sites such as the PatternShare Community, some must be useful in ASP.NET applications. Yet a search of the web revealed that -- while there is plenty of material out there on design patterns in general, and their use in executable and Windows Forms applications -- there is little that concentrates directly on the use of standard design patterns within ASP.NET.

One very useful document is "Enterprise Solution Patterns Using Microsoft .NET," which discusses what design patterns are, how they are documented, and their use in .NET Enterprise applications. The article does not aim solely at ASP.NET, but has plenty of ASP.NET coverage.

About Design Patterns

Because there is so much general material available on the aims and the documentation of design patterns for executable applications, I will restrict this discussion to a few basic points before moving on to look at the patterns I find most useful in ASP.NET. The References sidebar that accompanies each article in this series contains links to many useful resources and web sites related to design patterns in general.



While many people (myself included) find the term "design patterns" just a little scary -- due not least to the way that they are usually described and documented -- most developers use informal patterns every day when writing code. Constructs such as try...catch, using, and switch (Select Case) statements all follow standard patterns that developers have learned over time. In fact, patterns can be:

  • Informal Design Patterns -- such as the use of standard code constructs, best practice, well structured code, common sense, the accepted approach, and evolution over time
  • Formal Design Patterns -- documented with sections such as "Context", "Problem", "Solution", and a UML diagram

Formal patterns usually have specific aims and solve specific issues, whereas informal patterns tend to provide guidance that is more general. As Brad Appleton, author of the book "Software Configuration Management Patterns: Effective Teamwork, Practical Integration", describes design patterns, pattern languages, and the need for them in software engineering and development:

"Fundamental to any science or engineering discipline is a common vocabulary for expressing its concepts, and a language for relating them together."
"... a body of literature to help software developers resolve recurring problems encountered throughout all of software development."
"... a shared language for communicating insight and experience about these problems and their solutions."
"A pattern is a named nugget of insight that conveys the essence of a proven solution to a recurring problem within a certain context amidst competing concerns."

This article and the following two articles in this series demonstrate how you can use some of the common formal patterns (some with minor adaptations to suit ASP.NET requirements) in your web applications to achieve the aims set out so succinctly by the Hillside Group. You can download the example application you will see in the following sections and open it in Visual Studio 2005, or install it to run under Internet Information Services (IIS). The download file includes a ~readme.txt file that describes the setup requirements.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap