Declaration of the NullObject_Exercise() function as used in the Null Object Pattern. More...
Go to the source code of this file.
Macros | |
#define | __NULLOBJECT_EXERCISE_H__ |
Functions | |
void | NullObject_Exercise (void) |
Example of using the Null Object Pattern. | |
Declaration of the NullObject_Exercise() function as used in the Null Object Pattern.
Definition in file c/NullObject_Exercise.h.
#define __NULLOBJECT_EXERCISE_H__ |
Definition at line 9 of file c/NullObject_Exercise.h.
void NullObject_Exercise | ( | void | ) |
Example of using the Null Object Pattern.
The Null Object pattern is where an object or function acts as a stand-in for real commands but otherwise does nothing.
In this exercise, movement commands are presented as characters in a string, with the characters 'u', 'd', 'l', and 'r' representing the moves "up", "down", "left", and "right", respectively. To keep the processing of this string simple, all other characters in the string are assigned a Null Object ("Do Nothing") version of the move command.
This example displays the commands after parsing and then "executes" commands, which consists of printing the commands out.
This example highlights the Null Object Pattern while also utilizing the Command Pattern and Interpreter Pattern.
Definition at line 275 of file NullObject_Exercise.c.
References MoveProcessor_ExecuteMoveList(), and MoveProcessor_ShowMoveList().