Data, Context and Interaction - DCI

Learned something new just now - http://en.wikipedia.org/wiki/Data,_Context,_and_Interaction

Basically with DCI we have

  1. Data - the stuffs you have, what your system is made of i.e Bank accounts 
  2. Context - representation of use cases, scenario involving your data i.e Wire transfers
  3. Interaction - you can think of it as roles.

DCI on Ruby/Ruby on Rails

p/s: Will come out with my own example soon.

Bug for private method in Ruby < 1.8

Source. This is a bug apparently :).

Delegate module for Ruby

Another way to do delegation (continue from previous post) is by using the Delegate module. Refer to the Rails Magazine article in previous post

Forwardable module for Ruby

Was reading Rails Magazine first edition (get it here) when I found about this module. http://railsmagazine.com/articles/4

Below is an example of SingleForwardable module extended in an object

Checkout the Forwardable module which acts on a class.