Am new to design patterns, could you recommend a open code base (preferably in java) that has design patterns used explicitly and elegantly. Reading up GOF has left me confused am looking for a project that used a few patterns that interacted with each other. thanks.
You can look at JUnit and some of its docs. Also, JUnit is extremely useful tool by itself. I think any Java developer must know how to use it.
You can also find interesting conversation with Erich Gamma, posted on Artima.com:
- How to Use Design Patterns
- Erich Gamma on Flexibility and Reuse
- Design Principles from Design Patterns
- Patterns and Practice
- Eclipse's Culture of Shipping
Maybe, not all parts of that conversation are relevant to your question, but they all are very interesting.
Hi,
I think that there is not any code base with design patterns applied. This patterns are applied differently from project to project.
The pattern is a guide, a proven solution to a common programming or design problem that has been around in the development life cycle.
I would like to suggest to read the Head First Design Pattern book, it is very to the point and has a nice examples.
Regards
The JDK itself has some good examples.
For example, the InputStream
/ OutputStream
, Reader
/ Writer
implementations demonstrate usage of the decorator pattern, in the sense that you can wrap an OutputStream with another implementation in order to layer on additional functionality.
Rather than a code base, i will recomend the reading of Head First design Patern , by oreilly. This books contains some really didactic exemple.
But the JDK is full of Design Pattern too. You can find Observer/observable , Iterator. Or more subtle, Decorator in the Java I/O API
May I recommend just looking at Wikipedia instead of GoF? I found the book hard to read, but the Wikipedia Article on Design Patterns was awesomely useful for me.
It then drills down into useful examples, such as Singleton, Lazy Initialization, Decorator and so on, all with good code examples, and all free.
I think you need to see how Patterns are applied in practice in the real world, the book Core J2EE Patterns: Best Practices and Design Strategies (2nd Edition) is a bench mark book showing the main patterns used to produce real Web Application in java.