Saturday, November 5, 2011

Template Design Pattern

You have a base class with a template method that lists actions you want to execute. Inheriting class is what actually implements methods customizing them as appropriate for the type of robot that you are creating.
Automotive Robot:
Starting....
Getting a carburetor....
Installing the carburetor....
Revving the engine....
Stopping....

Cookie Robot:
Starting....
Getting a flour and sugar....
Baking a cookie....
Crunching a cookie....
Stopping....
Cookie Robot:
Starting....
Getting a flour and sugar....
Baking a cookie....
Stopping....

No comments:

Post a Comment