Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Design Patterns - when and why?

 
Kameswari Jyosyula
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I would like to know as to why one should use design patterns and what design patterns are mostly used in the industry.Also, how is the usage of these design patterns decided - like when to use the factory pattern etc..
Could someone shed light on this please.
I am going through some good books on them but would like a heads up in this.
TIA
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the GoF book! The idea is that there are certain groups of problems that are common to most programming efforts. Once a pattern has been discovered that can solve that problem, programmers should use that pattern instead of constantly "reinventing the wheel."
 
Gavin Hogan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Really an old (generally informal) practice that's getting some formal attention. But from what I've read on it so far (admittedly limited), it is difficult and takes time and familiarity with the topic to understand when and how to apply a given pattern. My preference would be to attend a hands-on workshop with someone who's been working with them for quite a while.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the best ways to familiarize yourself with patterns is to read code, lots of it, both good and bad. Keep a good patterns book handy, and try to work out what patterns have been used where, and why (or why not). Some source code is available with comments or dicuments describing which pattersns were used and why (check out JUnit, for example).
Think about design patterns in real world terms, and look for them in everyday processes. You will start to see them everywhere ...
 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only really new thing about patterns is that they are now being formally (or informally) documented. But what a change that is!
One approach I used to learn the GoF patterns was to pick one pattern (or more) a week, read its section in the book and then code up the code from the book or come up with an example that used the pattern. This allowed me to get at least some feel for the pattern. Doing design and coding, or looking at designs and code, are also a good way to see how patterns can be used (and abused).
John
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic