What does my project do?

Using specifications as a live project documentation

3 min read

A list of things to-do in a project usually sits in a backlog, but how do you know what was already done?

For the past few months I’ve been working on one project, a few hours each month. Each time I’ve faced the same frustrating problem – each time I got to work on the project I had to figure out what’s already implemented. Each time was an almost fresh onboarding experience.

One solution to the problem is to keep documentation up to date. But even though everyone agrees that you should do it, documentation can very easily go stale. And suddenly you find yourself rewriting whole docs becuse it’s so out of date.

What if this documentation was live? And got updated each time you add a new feature?

This is what I did in a project I’m working on.

What writing acceptance tests give you

When we test from a perspective of business requirements, we write acceptance tests.

They are written to describe the behavior of the system, to encode business rules, and to not reveal implementation details. This is a perfect place to understand what the project does, if one practices writing such tests… I do, and I encourage everyone to do so.

So let’s imagine you have those tests.

Imagine you have, let’s say 10, files with those executable specifications. Each file describes a part of the system, a feature, a concept. Yes, you can go through each file and understand what’s going on (assuming completeness of those specifications). But depending on the size of the system it could take you a while to go through all of them.

And other issues arise:

  • is there an order to those specifications?
  • is there an overarching story the project tells?
  • are there branches to the story, like user journeys?

How to present those specifications to tell a better story about the system?

Introducing FEATURES.md

I asked myself “What would make my onboarding the quickest?”.

I imagined there is one file in the repo, always up to date (no, not README.md), that would tell me the story of the system. Just skimming through it would give me a good idea of what the system does.

Running tests already leaves trace - each testing framework has their way of reporting progress or results. So I thought, why not use that information, and reshape it, to tell a better story?

With a simple preprocessing and extra annotations one can create a processor that takes the test results and generates a FEATURES.md file.

Here’s how a FEATURES.md might read:

The cost

The obvious cost is that you have to write acceptance tests.

But if you do, you get a lot more than just a FEATURES.md file. You get repeated verification if the system does what it should do. You get a safety net for refactoring. You also get a nice entrypoint for coding agetns to get an understanding what the system does.

You may notice that keeping README up to date is cheaper. It is, but it doesn’t yield the same benefits. And even with the best regime, it will eventually drift from what the system really does.