29 Jul '16, 9am

Tidy Views and Beyond with Decorators

The system obeys the Tell don’t Ask principle where you should tell an object to do something as opposed to extracting data from it and implementing behavior on the caller code. Here, instead of asking a monkey if it is eating in order to display a state message, we tell it to give us the message simplifying and removing branches from the client code. By not polluting the Monkey model, we’re also obeying the Single Responsability Principle where every object should have only one responsability and it should be encapsulated by one class. The Monkey class handles database finders, field abstraction, and data consistency via validations, not more than that. On the other hand, the decorators handle presentation related state and logic while delegating to Monkey when appropriate. Finally, it obeys the Open/Closed Principle where each object is open for extension but closed for ...

Full article: https://robots.thoughtbot.com/tidy-views-and-beyond-with-...

Tweets

A case for decorators in Rails

rubyflow.com 06 Aug '16, 11pm

× The Ruby and Rails community linklog Made a library? Written a blog post? Found a useful tutorial? Share it with the Rub...

ULTRA Singapore adds Above & Beyond, ZHU and ot...

dancingastronaut.com 31 Jul '16, 1am

With less than two months left before show-time this September, ULTRA Singapore has announced phase two of its already sta...

Distinct Life x Reebok Bolton 'Distinct Views' in Merlot

Distinct Life x Reebok Bolton 'Distinct Views' ...

sneakerfiles.com 31 Jul '16, 12am

For those interested in purchasing the Distinct Life x Reebok Bolton Distinct Views that comes in Merlot, they are now arr...