Banker role or not?

50 views
Skip to first unread message

Hai Feng Kao

unread,
Feb 16, 2022, 2:04:13 PM2/16/22
to object-composition
 mbrowne's javascript DCI example uses the banker role in the TransferMoney example.

 role banker {
        transfer() {
            source.withdraw();
            destination.deposit();
        }
    }

However, in Trygve's book "the Common Sense of Object Oriented Programming" page 20, 
Trygve let TransferMoneySource role initiate the transfer (instead of banker role)

role source {
        transfer() {
          this.withdraw();
          destination.deposit();
        }
}

Which way is preferred by DCI? 
1. a coordinator (i.e., a banker role) to supervise the interaction of objects
2.  let objects "talk" to each other



    
Reply all
Reply to author
Forward
0 new messages