Speaking of talks, I will be presenting at JavaOne today (4:10 pm in Gateway 102/103) on “Design Patterns Reconsidered”. I’m about 80% excited and 20% terrified, which is a good mix for me. I’ve given this one in different forms a couple times and I know this will definitely be the best version of it I’ve ever done. If you’re interested in design patterns, stop on by.
The design patterns movement launched a revolution in object-oriented design and provided a vocabulary for developers doing object-oriented development to communicate their ideas. However, in some cases, patterns used blindly can lead to awkward, confusing, or hard-to-maintain code. It is time for some common patterns used on the Java™ platform to be reconsidered so that we can derive the benefits from patterns while minimizing the concerns they can raise.
Design is a matter of balancing a variety of forces; patterns exist at the balance points between forces. In any particular scenario, those forces will not be balanced in the same way. Designers must then apply their knowledge of patterns and the product to find a unique instantiation of the pattern that optimally balances the forces at work.
This session re-evaluates key patterns such as Singleton, Template Method, Visitor, and Proxy. These patterns have downsides and do more harm than good in some cases. The presentation gives examples of each pattern in the Java development environment and examines them for clarity, testability, and flexibility. It discusses important problems and gives examples of alternative solutions, including ways in which Closures could be leveraged in a future version of the Java platform to alter these patterns.