#RemotePairProgramming Ep 014: Adi & Emily – Approval Tests with Lift Kata

The book Facilitating Technical Events is for technical trainers, coaches, events organizers who want to have a good event flow and happy attendees.
Support independent publishing: Buy this e-book on Lulu.

About

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.

Premise

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.

Adi and Emily

Problem:

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.

Lift features:

  • 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

Video

Check the video Approval Tests with Lift Kata and please come with your ideas and comments

Acknowledgements

Many thanks to Emily for recording this Approval Tests with Lift Kata codecast with me.

What’s Next?

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

Subscribe

If you want to receive an email when I write a new article, subscribe here:

Subscribe for new articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe for new articles