Raja
Raja

Reputation: 3618

How useful are design patterns when it comes to web programming?

Background: My organization uses Microsoft .Net (3.5) with SQL Server 2005 as back end.

With RAD being the norm and Agile being the widely used process. I have always found using design patterns difficult since it involves a bit more understanding and bit more training.

Can you give me some examples where design patterns have solved real time problems in Web programming? What is the criteria for using any design pattern? What is the benefit reaped from it.

I know it is a general question but this would help me a bunch.

Upvotes: 3

Views: 916

Answers (3)

derdo
derdo

Reputation: 1036

Here's a little bit of a different approach that might help you on your quest. Learn the patterns as a way to see examples of good design instead of only looking for places where a specific pattern can be applied. I believe understanding why patterns are good designs is the key to using them effectively. As a start, Factory Method, Strategy and State are easiest to learn and probably most commonly used correctly. Once you get the hang of those patterns and the principles that make those patterns good designs you can move on to more complicated patterns that might be more useful in your web app such a Model-View-Controller, Abstract Factory etc.

Upvotes: 5

JB King
JB King

Reputation: 11910

There are a number of patterns I've seen:

MVC/MVP - This comes up often in doing forms where there is the need to handle business logic separately from the UI and the domain objects are a third part to this.

Adapter - Database connections can use this part so that one doesn't have to know what kind of DB connection there is, it just works.

Strategy - Ever have different ways to perform what is almost the same operation on different types of devices? I have and this is what I used was a simple Strategy pattern.

Singleton - Ever use the Application object in ASP.Net? That's an example of the Singleton pattern in use.

Factory - This kind of goes hand in hand with the Strategy case I mentioned earlier as the Factory may produce a specific type of object that is needed and I remember seeing this back in classic ASP 6 years ago now.

The pattern is a way to solve a specific type of problem in rather general terms, thus there are lots of grey shades in understanding when to use this one or that one.

Upvotes: 1

drekka
drekka

Reputation: 21883

Design patterns are both an answer and a way to communicate ideas. One of the best ways to understand the benefits is simply to do some reading on the basic patterns and then look back through you own code, APIs you make useful and other code and you will find many instances of those patterns being applied. Simply because thats what they are, a distillation of common applied solutions to problems.

Upvotes: 1

Related Questions