in Search

cruizer

aspiring to free and open the mind of .NET developers

Design patterns are NOT from hell

I saw this somewhere in my daily reading list (I religiously browse my Google Reader at the start of the day).

I thought to myself that the blog author probably had negative experiences with programmers or architect types who place too much emphasis on design patterns.  I agree that people who give too much importance (or "cool factor") on design patterns will probably see the trees but not the forest.

Personally, I agree with the author that the problem has to be understood before a solution can be applied.  It was said that there was supposed to be this app whose developers wanted to implement all 23 GoF design patterns -- of what use is that?!  It's like putting the cart before the horse.  One has to feel the pain of a particular problem before a solution can become suitable and be appreciated.  That's why I believe in refactoring to patterns.

But that doesn't make me conclude that design patterns are from hell.  Just because one thing can be used negatively by some doesn't mean it's evil -- see for example the internet, or TV.  I had to eat my words not too long ago when I said that enums are evil. Stick out tongue I see design patterns as useful in enabling developers to share a common design vocabulary ("you plan to use the state pattern there? that's too complicated, why not use strategy instead...") and it helps me identify possible solutions to design problems.  I wouldn't be proud of my code just because it implements this and that pattern -- I would be proud if it meets user expectations and runs relatively bug-free!

 

Only published comments... May 02 2008, 10:40 AM by cruizer
Filed under: ,

Comments

 

LaTtEX said:

Saw that post too. Badtrip lang hindi makapag-comment kasi kelangan mag-login.

He clearly doesn't know that there's such thing as Refactoring to patterns. However he is right, in the sense that it is dangerous to read the GoF book without first understanding if <em>it's the only book you read about design patterns</em>. Kelangan basahin din yung Head First saka yung RTP saka yung Martin Fowler Enterprise Patterns book.

Treating the GoF book as a Bible is *the* big, big mistake.

May 1, 2008 10:17 PM
 

cruizer said:

well in fairness to the GoF book the authors said they never wanted it to be the be-all and end-all of the design patterns movement. they only wanted to open the floodgates, so to speak ;)

May 1, 2008 11:13 PM
 

fyap said:

I actually like Design Patterns... kasi uniform yung codes. Madaling maintindihan yung codes kahit na hindi ikaw yung nagsulat.

May mga teams dito sa company ko na di sila nag-aarchitect ng code nila, and they always complaint na buggy daw si ASP.NET Datasource,  etc. If they know design pattern, and implement it, I think they would not have such problem.

May 1, 2008 11:27 PM