Moderatoren: pmueller, SE - Design and Construction
- Beiträge: 106
- Registriert: 20. Apr 2016 22:49
It is mentioned in the slides.
Unlike Strategy, variations encapsulated in decorator
objects do not leave any footprint in the behavior of the
objects being adapted
How does strategy leaves a footprint? they are chosen on the runtime, for example a Map application so the navigation can be "Walk", "Car", "Bicycle" but each and every strategy is different and Map does not know about which one of them is chosen at the runtime.
So what does it means?
- Beiträge: 87
- Registriert: 25. Jan 2018 11:14
you can see an example for this in slide 7 of the Strategy lecture,
The layout manager is a field of Container. This obviously leaves a footprint, although the manager can be changed at runtime.
The Container uses the interface of the Strategy directly.
On the other Hand, if you are using a decorator, the wrapped object is not modified in any way directly, and it is now "aware" of the fact that it is decorated.