Yesterday, I gave this talk at Groupon's weekly GeekFest event: Design Patterns for Rubyists - Who Said Dynamic Languages Can't Have Patterns?
It is part II of the Software Design Trilogy. You can check part I (Responsibility Driven Design for Rubyists) over here.
The slides are included below. Here is the abstract:
Design Patterns have gained a lot of popularity for helping programmers achieve polymorphic object oriented code in statically typed programming languages like Java and C++. However, although the original Design Patterns book by the Gang of Four used Smalltalk, a dynamically typed language, in some of its examples, Design Patterns have not nearly gotten the same popularity in Ruby, and sometimes for good reasons. Ruby supports duck-typing and makes it very easy to do meta-programming, which alleviates the need for many of the Gang of Four Design Patterns. Additionally, Ruby can often provide easier implementation alternatives for certain Design Patterns such as State, Strategy, and Adapter. That said, Design Patterns can still offer a great value in Ruby as problem-solving tools that yield better object oriented code with higher cohesion and cleaner separation of concerns. This is clearly demonstrated in Design Patterns like State, Composite, and Decorator.
- Design Patterns Pop Quiz
- Practical Applications of Design Patterns in Ruby
- Alternative Implementations in Ruby
- Deprecated Design Patterns in Ruby
Attendees should walk away with a good overview of Design Patterns as well as examples of applications in Ruby and corresponding implementations. This will help them get a head start on sharpening their Design Patterns skill in Ruby, thus recognizing when they can benefit from applying them in day-to-day work to improve code structure and maintainability.
Stay tuned for Part III of the Software Design Trilogy: Domain Drive Design for Ruby on Rails