Yesterday I went to the latest NxtGen user group talk about Patterns.
Before the event I was intrigued by how he was going to approach presenting such a huge topic. It’s not that design patterns are complex, presenting to a developer audience and focusing on the theory rather than the code used in examples is difficult at best.
This turned out to the case, and despite Gary repeatedly asking the audience to take a high level view, he had to talk about ‘his’ actual implementation on more than one occasion. This might be fair enough but when he showed code where an age parameter defaulted to 0, there was a discussion about why he didn’t use a nullable type. Why can’t people take a step back and focus on the principle.
What I liked about the talk was his warning to developers not to adhere to the code samples for patterns in the books on patterns or those on the web. One example was the singleton pattern done in C# using a static parameter as opposed to locking strategies avoiding problems with thread safety and locking. The key point here is that examples were written to solve a problem with the language/framework used by the author but a .Net compiler will handle many issues for you.
What I didn’t like was approach taken to show design patterns. As I said above it is a very difficult topic to present and to cover ‘everything’ in a couple of hours would be asking the impossible. Of the numerous resources I have read, the Refactoring to Patterns book is my favorite. I liked the way code examples were shown to solve a problem, discussed and then refactored to use patterns with an explanation of what improvements had been made. This meant the reader had an understanding of how, when and which design patterns can be used to solve problems they comes across.
As of yet I have not done a presentation to a developer audience and so until I do, I would only take my thoughts at face value. Gary started well but he didn’t ‘sell it’ or in other words I don’t think many people left the room wanting to find out more about design patterns.