June 2018
Beginner
722 pages
18h 47m
English
The final version of our API looks as follows:
public interface Calculator { int multiplyByTwo(int i); static Calculator createInstance(){ return CalculatorFactory.create(); } static String addOneAndConvertToString(double d){ return CalculatorFactory.addOneAndConvertToString(d); } String CONF_NAME = "calculator.conf"; //file name String CONF_WHICH_IMPL = "which.impl"; //key in the .conf file enum WhichImpl{ multiplies, //uses multiplication operation // and returns addOneAndConvertToString() // result without formating adds //uses addition operation // and returns addOneAndConvertToString() // result with two decimals only }}
This way, we maintain the single source of record—the interface that captures all the API details. ...
Read now
Unlock full access