June 2018
Beginner
722 pages
18h 47m
English
When we talked about decoupling in the previous section, the idea of flexibility and maintainability probably came to mind by association. Loosely coupled systems are more flexible and easier to maintain.
For example, in Chapter 6, Interfaces, Classes, and Object Construction, we demonstrated a flexible solution when implementing an object factory:
public static Calculator createInstance(){ WhichImpl whichImpl = Utils.getWhichImplValueFromConfig(Utils.class, Calculator.CONF_NAME, Calculator.CONF_WHICH_IMPL); switch (whichImpl){ case multiplies: return new CalculatorImpl(); case adds: return new AnotherCalculatorImpl(); default: throw new RuntimeException("Houston, we have another problem."+
Read now
Unlock full access