CoffeeMakerAPI
Java interface. Robert also published the complete Mark IV Special Coffee Maker chapter for us.
I am not here to give another solution for the problem. Instead, I wrote the CoffeeMakerGUI application, that contains a
CoffeeMakerAPI
implementation that lets you to manually test your solution by using a simulated Coffee Maker machine:
To compile it using a Java compiler, you need the
CoffeeMakerAPI
Java interface (given in the mentioned chapter) and also the following interface:public interface CoffeeMakerImpl { void createComponents(CoffeeMakerAPI api); void pollComponents(); }
You can run the application without parameters, and a help message will be printed, but to test your solution you have to connect it with CoffeeMakerGUI, and to do it you must pass as the first argument of the program a class implementing the above
CoffeeMakerImpl
interface and having a default constructor. So the command to run it could be, for example:java CoffeeMakerGUI MyCoffeeMakerImpl
The program will instance that passed class and will call to
createComponents
passing a reference of the CoffeeMakerAPI
implementation. Then, it will call to the pollComponents
periodically to "wake up" your implementation.Thanks to Uncle Bob for publishing that interesting problem and solution!
No comments:
Post a Comment