Tag Archives: Design Patterns

Comparing Design Patterns in Ruby and C#: The Command Pattern (with Robots!)

The command pattern is another one of those patterns that we all (whether we realize it or not) see almost every day. It’s commonly used in UI development but it’s a pattern that can be applied in many situations. In rails, ActiveRecord migrations are a perfect example of a command implementation, including “up” and “down” [...]

Read Post

Comparing Design Patterns in Ruby and C#: The Iterator Pattern

Continuing our exploration of design patterns in Ruby and C#, we’re going to dive into the Iterator pattern. Like most design patterns, if you google (or bing) for an example you will run into several different implementations because there are many ways to iterate a collection of objects. In it’s classic (well, classing in the [...]

Read Post

Comparing Design Patterns in Ruby and C#: The Composite Pattern

In the last post of the series, we took a look at the Observer pattern. This time we’re going to explore the Composite pattern. The Composite pattern gives us the ability to take a complex procedure that may involve many steps and turn it into something that is simple for consumers to use. The classic [...]

Read Post

Comparing Design Patterns in Ruby and C#: The Observer Pattern

Continuing our comparison of design patterns in Ruby and C#, we’re taking a look at the Observer pattern. With this pattern, we have a subject and a list of observers that are interested in knowing when changes occur on the subject. This happens in a push model, the subject maintains the list observers and notifies [...]

Read Post

Comparing Design Patterns in Ruby and C#: The Strategy Pattern

In the previous post of this series, we looked at how the Template pattern is implemented in both Ruby and C#. In this post, we’ll take a look at the Strategy pattern…one of my favorites. In it’s classic form, the Strategy pattern consists of a context class and various “strategies” which share a common interface. [...]

Read Post

Comparing Design Patterns in Ruby and C#: The Template Pattern

Most of my career has been in .Net development and I’m pretty comfortable applying design patterns in C#, but as I’m learning Ruby, I was finding it difficult to figure out how to implement them without creating awkward, hard-to-read code. Recently a local Ruby guru, Nate Klaiber, recommended that I pick up the book Design [...]

Read Post