| Design patterns is one of my favorite topics ever since I started programming in object-oriented languages. In fact for the first several months I discovered many of them independently and really enjoyed the process, without the slightest idea that they are known to people by various names. Apart from applying design patterns, I also enjoy reading, writing and discussing about design patterns. For the past couple of years I have also been teaching design patterns a whole lot. I thank Trilogy/Versata, the organization where I first worked, to give me several opportunities to deliver presentations and workshops to the interns and new hires - including '07 batch of interns, '07 batch of new hires and '08 batch interns. Discovery of Design Patterns During my design evangelism at Versata, I developed a technique for introducing design patterns, especially to the uninitiated. It is a 2-step approach that I call Discovery of Design Patterns- Step 1: Enter the World A presentation that is meant to be a gentle introduction. It includes-
Step 2: Find the Jems A workshop with real world-ish design problems to solve. Every problem is nothing but a programming scenario in which the logic to be encoded is perfectly straightforward. The challenge is partitioning the logic blocks and responsibilities in a neat way. Most often the first solution that strikes turns out to be too cumbersome to read, maintain, reuse or may present similar issues. Every problem is targeted to introduce one design pattern. This is how I typically go about each design problem-
The key in making this work lies in the ability to analyze the design solution that the group throws up at you. The ability to identify and explain issues, introduce concepts intuitively at the right time and be able to nudge them in the right direction by asking the right questions - and not by just showing the way. Unless the group arrives at the design pattern solution, the exercise does not achieve its fullest effect. The set of design problems I use is here. 9 Planets Here is an example of a design problem. I have also captured the minutes from one of the discussions of this problem to make the idea more clear. |
