algorithms (22) Design Patterns (20) java (19) linux (14) Snippet (13) service mix (6) soa (4)

Template Method

"Defines the skeleton of the algorithm , and defers some implementation to the sub classes."

the above example makeDrink() calls

  1. addWater
  2. addFruit
  3. addIce
the addFruit implementation is left to the sub classes orange and apple juice makers

the method makeDrink is made final so that the steps of making the juice is not changed


Search 24 Bytes