We will provide:
A reminder about UML arrows if you need to know them
We will provide:
The written out names of the SOLID principles
For each principle know:
What the principle means
What a violation would look like
What code would look like if it were satisfying the principle
We will provide:
The class diagram of the pattern
For each pattern know:
What code smell and design principle violation would motivate the use of the pattern. For this don’t just know a pattern is violating “Switch on type”. You’ll need deeper knowledge like (for Composite) “The switch on type is deciding what behaviour to carry out on each of the different kinds of elements that might be pointed to by the object”. Or (for Factory) “If all the creational behaviour is in a single Factory class, then the switch on type would be checking which kind of product is being made”
What the “before” code would look like (examples in slides). Singleton is the exception - you don’t need the refactoring story for Singleton.
Where the behaviour would end up after refactoring to the pattern (again, examples in slides). For instance (for Factory) moving all the specific creational behaviour to its own factory.
The dynamics of the pattern – how the code is invoked and how the pattern works. For instance, for Factory, main calls factory.makeObject which then does a load of stuff and calls the constructor for the object, and then returns that object. For visitor, this is understanding the mechanism of the double dispatch trick of the there-and-back with visit and accept and why it’s needed in an single dispatch language. For State, it’s understanding where the state change happens in the two variants – the state machine variant and the externally imposed state variant. For Singleton you should remember the structure and how it relates to dependency injection.
We will provide:
The code of ethics if you need the whole thing
You should know
What a solution we discussed in class (usually informed consent - but make sure you know why it would be helpful)