Presentation on theme: "Decorator Pattern Lecture Oo29 Artificial Life Simulation."— Presentation transcript:
Decorator Pattern Lecture Oo29 Artificial Life Simulation
Teaching Points n Decorator Pattern n Artificial Life Simulation –Lab 3
Review n What is a component n How can you use components and interfaces to efficiently partition your system’s physical architecture? n In Java-style exception handling what is “thrown?”
Decorator Pattern n The Problem –sometimes we want to add responsibilities to individual objects, not to an entire class. –for responsibilities that can be add/withdrawn dynamically –when extension by subclassing is impractical
Decorator Pattern n The solution –Attach additional responsibilities to an object dynamically. –A flexible approach is to enclose the component in another object that adds the responsibility.