4 ms·
As long as the interactions you're working with don't implement the same methods, it would be trivially easy: class Account; …; end class Withdrawer < Simp
by halostatue 14y ago
As long as the interactions you're working with don't implement the same methods, it would be trivially easy:
class Account; …; end
class Withdrawer < SimpleDelegator; …; end
class Depositor < SimpleDelegator; …; end
acc = Depositor.new(Withdrawer.new(Account.new))
acc.withdraw(40)
acc.deposit(100)
At least that's how I understand it. I'm not convinced that DCI is worth it, but…I don't yet have a need for it in the application that I'm working with.