Saturday, October 07, 2006

Java Design patterns - Few tips to learn.

Learning & remembering design patterns is a difficult task. The real world working samples & real world metaphors on how really a pattern is used to effectively to solve a problem in a given business context is very important in learning patterns.

I found this article on http://mahemoff.com/paper/software/learningGoFPatterns/ is very useful in that context.

I really liked idea of coming up with metaphors for each pattern & I think if the metaphor includes some of the open source code as samples it will be really great. Cooper's book on design pattern gives only the java SWING samples & I guess it would be better we can extract the patterns samples from popular server side java framework. 90% of java programmers write server side programs & not the SWING.
Unless untill these pattern samples are captured from successful implementation (with real productivity improvements) I really doubt the effectiveness of the patterns. I felt the samples provided by Martin Fowler (Both in Archtectural & Refacatoring pattern books) are mediocre & outdated.

Here are the few steps I suggest to learn patterns;
1. Buy this book, best book to learn & remember patterns
http://www.oreilly.com/catalog/hfdesignpat/
2. Go through the popular open source framework code (Hibernate, Spring etc...) . Most of the class name start with pattern names & it is very grasp their usability that way very easily
3. Don't ever force yourself to use patterns in your code/application. It is very important that it should come naturally & read the related anti-patterns before using it.

Remember real stregnth of patterns is when it is used as design communication tool & hence it has to be correct, precise & contexually relevent.

No comments:

Bookmark and Share