kalelc / ruby-design-patterns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ruby Design Patterns

Template Method

Identifies the framework of an algorithm, allowing implementing classes to define the actual behavior.

Strategy

Identifies a set of encapsulated algorithms that can be swapped to carry out a specific behavior.

Note: With the Template Method pattern, we make our decision when we pick our concrete subclass. In the Strategy pattern, we make our decision by selecting a strategy class at runtime.

Command

This pattern separates out something that changes—the thing that we want to happen when the button is pushed—from something that does not change.