On 2/15/10, Brian Candler <b.candler / pobox.com> wrote:
> Caleb Clausen wrote:
>>   Those roles in turn simply forward the #transfer message to some
>> other method(s)
>>   (increaseBalance and decreaseBalance in this case)
>>
>> Please let me know what you think of this.
>
> I think it's more limiting that what DCI is supposed to offer; I think
> you are supposed to inject *new* methods into the underlying objects to
> help them fulfil their roles, rather than just mapping existing ones.
> That is, the role contains extra logic which in normal OOP might pollute
> the model, and DCI helps separate it out.

So, you're saying that this method, which I had optimized away:

  class Balance::TransferDestination < Role
    def transfer(amount)
      increaseBalance(amount)
      puts "Tranfered to account #{__id__} $#{amount}"
    end
  end

should be able to contain arbitrary amounts of logic?

Let me think about this some more. Maybe I'll try again.

> I still haven't achieved enlightenment as to what is new or different
> about "DCI". The view contexts might provide meatier examples. I did

I have the feeling this is one of those theoretical things that seems
really complicated but once you understand it its actually quite
simple.