Emily Bache and I have a remote pair programming session. The focus in working on the Approval Tests with Lift Kata that Emily created. We use Approval Tests to check each step in the progress of the implementation. Fast feedback and continuous communication are a good recipe for a quality pairing session.
About approval tests with lift kata. The code already has a starting point which is very useful for getting to work fast. There is a printer that can print the lift status in ASCII art format. We start from this minimal start-up and add approval tests in a TDD approach with small steps and incremental thinking. We add production code step by step as we add the tests.
Since lifts are everywhere and they contain software, how easy would it be to write a basic one? Let’s TDD a lift, starting with simple behaviors and working toward complex ones. Assume good input from calling code and concentrate on the main flow.
- a lift moves between a number of floors.
- a lift has a panel of buttons passengers can press to request floors.
- people can call the lift from other floors. A call has both a floor and a desired direction.
- a lift has doors which may be open or closed.
In this repository, that much is already implemented. The following features are not yet implemented:
- a lift fulfills a request when it moves to the requested floor and opens the doors.
- a lift fulfills a call when it moves to the correct floor, is about to go in the called direction, and opens the doors.
- a lift can only move between floors if the doors are closed.
Lifts do not respond immediately or do everything at once. To simplify handling time in this exercise, the provided LiftSystem class has a ‘tick’ method. Every time you call it, the lift system should simulate a unit of time passing, and update its state according to what changes occurred during that time period. Lifts can move between floors or open their doors for example.
To simplify things, Lifts only accept new calls and requests when they are on a floor. (Then we don’t have to model what happens when they are between floors).
You can find the code and the whole descripton here: https://github.com/adi-bolb/Lift-Kata/tree/pairing-with-emily
Check the video Approval Tests with Lift Kata and please come with your ideas and comments
Many thanks to Emily for recording this Approval Tests with Lift Kata codecast with me.
Watch other episodes of remote pair programming: https://www.youtube.com/playlist?list=PLlOmk325wSKLFF3pXOLVjzZHhQhs_2Ds8
Watch Legacy Coderetreat: https://www.youtube.com/playlist?list=PLlOmk325wSKLytvYhnGLR0v3PhWNdGMon
Watch Evolutionary Design: https://www.youtube.com/playlist?list=PLlOmk325wSKLjw_RGzpBV8MIfi4zSlbwM