Notebook Driven Development

- 1 min

Recently I have been developing a larger Python system for data analysis. The system is supposed to be distributed and contains many sub-modules.

I want to briefly discuss a development methodology that I have adapted and that has helped me greatly with the development.

For every module in the project, I create a Jupyter notebook. In these notebooks, I methodically go through the intended uses cases using examples. I call this methodology Notebook Driven Development.

This serves three purposes:

  1. It helps you think about the needed use cases and how the interface should be designed to best serve them. It also promotes design without cyclic dependencies since these are easier to test.
  2. The notebook contains light-weight functional tests. These tests complement unit tests.
  3. Finally, the notebook becomes documentation on how to use the module. Something in between a readme and a short user guide.

I plan to use this methodology for projects that are exploratory by nature and at the end of the next year write a new blog post evaluating the experience.

What do you think about the idea? Old news, useful or even undermining proper TDD? Tweet or write your thoughts to me.

Erik Gärtner

Erik Gärtner

Research Scientist at RADiCAL