SE450: Review: Pattern Summary: Structuring Behavior (Replacing Conditionals) [23/25] |
Null Object: Replace null reference with an object with trivial behavior. Eliminates if-null-then-else.
Proxy: Keep an interface, but delegate functionality to another object. A proxy objects sole purpose is to control (or enable) access to another object. Eliminates if-then-else.
Decorator: Modify the behavior of an object, maintaining its interface. The decorator delegates some of its function to the object it is decorating. Eliminates if-then-else.
State: Create the illusion that an object changes its actual type (using delegation to a field). Eliminates switch/case.
Chain of Responsibility: Give more than one object a chance to handle a request. Chain the receiving objects and pass the request along the chain until an object handles it. Eliminates switch/case. Not on final exam.