In this episode, we finish test-driving the
NavigationControllerRouter implementation, and we undergo a significant refactoring by replacing the old hard-coded
String type questions with the new
Question enum type.
We face a challenge when implementing a stub for the result as it does not conform to
Hashable and its initializer is not public – we solve it by having a simple private extension only for the test module, as we don’t need this behavior in the production code.
Furthermore, we discuss other approaches for designing the Abstract Factory, such as making it conform to the Interface Segregation Principle, the I in SOLID.
Finally, we reflect on the updated architecture diagram as we foresee where the concrete factory should reside and discuss what would be the negative impact of poor design decisions.