4 ms·
If I understand what benjamin is saying, these would be written as: account.process_transaction(new loyalty_bonus(bonus_amount)) or possibly account.process_
by rprasad 14y ago
If I understand what benjamin is saying, these would be written as:
account.process_transaction(new loyalty_bonus(bonus_amount))
or possibly
account.process_transaction(new bonus(loyalty_bonus_amount))
depending on the business logic.
- glenjamin 14y agoNot quite, the point is that the caller doesn't care how much the loyalty bonus is, only that the bonus it is awarding is for loyalty. The value of the bonus then gets captured in the domain object. If there is enough related logic to justify having a loyalty bonus object, then you might have account.award(LoyaltyBonus.new) Or, if we're going to start slicing things up like this, we might go for: LoyaltyBonus.award_to(account)