Links News Contact Us About us Privacy Terms FAQ Add feedback Invite a friend Bookmark
Home Members Blogs Photos Groups Events Polls Forums Articles Boards chat
RIAguy's blog / technology / What's Wrong With Design Patterns?
What's Wrong With Design Patterns?
June 17, 2008June 17, 2008 Add comment2 comments technology technology

I have a problem with design patterns. I know - I should be thrown out the window by the development police. Design patterns are there to help developers use tested and appropriate ways of building software which includes tasks that are common to many programs. In that respect - they are just super.

My problem is that they are often, like many technologies, inappropriately applied. I was recently reving some javascript code which did a simple Ajax call to get some JSON data and stick it into a list. The developers (and yes there were more than one) built a complex, difficult to debug MVC (Model View Controller) framework for this task.

"Oh yes," I can hear you say, "but now that component can be reused and it has a known interface...etc...etc...etc." Sure, but I could have built a reusable component that did the same thing, with a known interface, with aboout 1/10th of the code. It would be easier to maintain, and it would perform better.

I can't tell you how many conversations about Flex I've had that began with someone asking me about PureMVC or Carngorm. They are both great frameworks, but they are not meant for every Flex application.

The wrong way to apply design patterns is to look for opportunities to apply them. You can honestly figure out how to apply almost any design pattern to any problem. The one and only right way to apply a design pattern is to start with a problem and find the best way to solve that particular problem. If the design pattern is the best way - then it's good. If it can be simpler, easier to maintain, requires less code, and more performant - then fantastic.

I personally find that a lot of MVC frameworks get totally out of hand and, rather than reducing complexity, make applications more complex.

Understanding design patterns is an impotant part of a devlopers knowledge set. Knowing when to apply them is wisdom. 

Comments
  • RIAGuruBy RIAGuru 171 Days Ago
    1 point    
    I have to agree with you on misused patterns. In my opinion one of the most commonly misused pattern in Java is Inversion of Control. It can make it very difficult to figure out what is going on as you have to look in config files, or even worse, you now have to search for instances of annotations to actually figure out what code is getting called in production. The rationale behind it is "Now you can plug in a different implementation very easily" however in practice I have found that you rarely do plug in a different implementation and so the overhead and difficult to follow flow is not worth the "feature" that will never be used. Don't get me wrong, I do think that there are times when IoC is a useful thing, just not always. I can also say the same about Aspect Oriented Programming but I will save that for another day.
    Reply to this comment
  • By Anonymous 19 Hours Ago
    0 points    
    saaev easas swsf ssad ssds ssasdsc sqssc sxsdxgv fady sasdx saasa csfcg dsfxsyxxysygtxsycysyfydyx cxdasaxs dafsxsxfsxdy
    Reply to this comment

Description
RIAguy
Posts: 5
Comments: 10
Rich Internet Applications and the Human experience. I write about technology I use - notable Flash / Flex / Silverlight and Ajax, and the way those technologies can make life better for humans.
Tags
3 ajax (3)
2 json (2)
2 ria (2)
2 dojo (2)
2 flex (2)
2 flash (2)
1 microsoft (1)
1 web-3.0 (1)
1 cairngorm (1)
1 future (1)
1 puremvc (1)
1 security (1)
1 jsonp (1)
1 javascript (1)
1 xhr (1)
1 mvc (1)
1 design (1)
1 internet (1)
Copyright © 2008 RIAspot.com