March 2018
Intermediate to advanced
324 pages
8h 30m
English
The end result can be the following:
public void receiveCommands(String commands) {
for (char command : commands.toCharArray()) {
switch(command) {
case 'f':
moveForward();
break;
case 'b':
moveBackward();
break;
case 'l':
turnLeft();
break;
case 'r':
turnRight();
break;
}
}
}
If you tried to write specifications and the implementation by yourself and if you followed the simplicity rule, you probably had to refactor your code a couple of times in order to get to the final solution. Simplicity is the key and refactoring is often a welcome necessity. When refactoring, remember that all specifications must be passing all the time.
Read now
Unlock full access