elcodi/elcodi — pull request #103 by carlescliment (2014-06-19 09:59:47+00:00)
Title: REFACTOR: Apply move method to increase the incapsulation of CouponBundl...

When an object brings a property from another object, transforms it and sets it back again, it is a bad smell which indicates that the manipulated class incapsulation is being violated.

By moving that code from the listener to the `Coupon` class, we obtain two benefits:

- The responsibility in the listener is significantly reduced.
- The listener knows less about the implementation details of the coupon class. By decoupling it, it will be more robust to change.
- The business rules are contained in the class they apply for, reducing the spreading of knowledge.
- By putting logic in the Coupon class, we allow other coupons to be added to the system that can extend the behaviour by using polymorphism.