Understanding subclass sandbox
The Subclass Sandbox pattern takes the idea of the template’s limited extension through subclasses (to provide security) and applies it the exact opposite way round. Here, the children define the order of execution for a set of pre-defined code blocks through an abstract spine function. These blocks take the form of functions that are defined in the parent class and can never be overridden. Each function deals with one thing to do with an external system in a standardized way. The following pseudocode makes a better visual point of how this is literally the opposite of the template pattern we explored previously, where everything previously marked as abstract gets functionality and the one function we had code in is now abstract:
Subclass sandbox pattern parent pseudocode
public class Sandbox_Parent { public: abstract void DoAThing(); protected: void PlaySound() { //Plays sound correctly } ...