Design Patterns.

July 20, 2008

Design Patterns are an essential tool for any object orientated programmer who wants to take his/her skills to the next level. Understanding the specifics of Design Pattern practices and methodologies will help developers uncover reoccurring patterns in software development and give them the tools to apply the correct solution.

For every difficulty encontered during application development, chances are this problem was encountered before (and solved). Design Patterns represent key programming practices that have been proven to get the job done in the most efficient, reusability and extensibility. This greatly increases efficiency of code and helps to break an application down into loosely compelled manageable chucks.

As a .Net developer you may have used some of these patterns without even knowing. A design patterns name captures the basic concepts that govern its use and a common practice is to include the pattern name in the name of the object that implements it.

You may have come across the following names while working with the .Net framework:

  • Proxy
  • Adapter
  • Command
  • Factory

The deeper your understanding of Design Patterns the more you’ll be to understand the .Net framework and how it can leverage you applications.

Main Design Patterns Concepts

  • Use interface inheritance over concrete base class inheritance
  • Create loosely coupled objects to promote code reuse by keeping object small and specialised
  • Defer / Delegate responsibility to specialised objects using composition

Choosing the correct pattern

The best way to decide which pattern is fit for the jobs it to break down your development specification into each requirement. If these requirement exhibit certain characteristics that relate to a design pattern then apply it. E.g. If you application is responsible for monitoring a file system and reporting changes back to a number of objects you are most-likely to implement the Observer pattern.

Summary

Once you have gained an understanding of object orientated concepts you should be ready to tackle Design Patterns. You will be surprised how many patterns that are already familiar to you and how much the put things into perspective. You’ll also find that the more you learn, the more you’ll see application development from a different perspective (almost like seeing the Matrix!!). To truly understand the benefits of Design Patterns you have to apply them to your application development. This will improve your object reuse and make future program changes less painful!

List of Design Patterns LINK:

  • Adapter Pattern
  • Command Pattern
  • Composite Pattern
  • Decorator Pattern
  • Factory Pattern
  • Flyweight Pattern
  • Intepreter
  • Model-View-Controller
  • Null Pattern
  • Observer-Observable
  • Singleton
  • State Pattern
  • Strategy Pattern
  • Template Pattern
  • Union Pattern
  • Visitor Pattern