Today’s post discusses the first of the behavioral pattern shown by the GoF, the chain of responsibility.
This pattern expects a series of commands to be executed and a set of objects capable to handle them.
Each of these “handler” objects can send the command to the next handler in the chain if it is not able [...]
Tags: design patterns, ruby, ruby on rails
Posted in Development, Metodologies, Ruby |
[POST UPDATE ON 19/07/2010 - 15:45]
Continuing our analysis of the Rails Best Practices today we’ll see two other tricks to make more readable method of the controller.
1. Methods within model
Suppose we have the classic user registry defined in such a way that an admin user can enable or disable other users.
The deactivate method inside user [...]
Tags: Best Practices, controller, factory method, ruby on rails
Posted in Development, Metodologies, Ruby |
This second post of the series leaves for a moment the creational patterns and speaks about one of the most important structural pattern: the Adapter.
The purpose of an adapter is “to convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.”
Suppose therefore [...]
Tags: design patterns, ruby
Posted in Development, Metodologies, Ruby |
COMMENTS