Template Method

1. Usage Define the skeleton of an algorithm in base class “Template Method” Steps required concrete implementation define as placeholders in base class Derifed classes fill-up placeholders with concrete implementations 2. UML class diagram 3. Pros shields the client from the details of the variant behaviour quality & productivity – only the variant behaviour needs […]

State Pattern

1. Usage Allow an object to change behavior when State changed. implements OOP Final State Machine(FSM) 2. UML class diagram Context is wrapper class – interface to state Define abstract state base class Define state specific behavior in derived state classes maintain pointer to current state in wrapper context class 3. Pros Easier to extend […]