A refactoring kata, to train on how to refactor UI code. The techniques you will use to refactor this code may be used on any application with an UI (web, mobile development, etc...)
Airdream is an airline company that is hiring you for a little evolution of their application. They have a booking wizard, and you are asked to add an additional step to the booking process: user should be able to select a hotel before the final review screen is shown.
Some documentation was left to you by the previous contractor that worked on that wizard. By the way, it is working just fine, so don't break anything when you add the new feature.
Booking is a linear process, made through several steps:
- Selection of the flight type: outward or round trip
- Selection the departure city
- Selection of the arrival city
- Selection of the departure date
- For a round trip only: selection of the return date
- Get the number of passengers
- Get the passengers first and last names
- Print preview of the booking and await for confirmation
- On confirmation, print a thanks message. On cancellation, print a see you soon message
- Yes, you will have to write tests.
- You should not refactor any code that is not tested, unless you are using your IDE automatic operations.
- Once you think you've finished, ask yourself if it is easy to replace the console input and output by some other system (like a GUI). If not, you probably have some more work ;)