BDD and just-in-time development
Behavior-driven development (BDD) has a powerful by-product – building just what we need to support our customers. Nothing more.
When we build software, we don’t have perfect information about the future. That means that as software developers implementing a feature, we can do one of two things:
- build software that anticipates as many possible future needs, or
- build software that supports what we need today.
Software development is costly
Building something that anticipates as many possible future needs sounds better in the abstract. Unfortunately, there’s a high cost of doing so.
Developing unnecessary software is expensive not only because of the direct cost of paying software developers but also because of the opportunity cost of our time – what else could we be building instead?
BDD as a practice helps us focus on delivering just what we need when we need it. That’s what I call just-in-time development.
Using BDD to guide feature development
In BDD, we start by writing tests from the customer’s perspective at the outermost part of our system. We then follow test-driven development’s (TDD) traditional red-green-refactor process:
- get a failing test (red),
- implement enough code to get it to pass (green), and
- clean up without changing the behavior (refactor).
Our feature is finished when we complete all three steps.
By codifying the expected behavior from our customer’s perspective in a test and following the TDD cycle from the outside-in, we build only that which satisfies our customer’s need.
Don’t build what you won’t need
Think of a feature as a circle. We can color the full circle right now – which takes time. Or, we can use BDD to draw only the slice we need.
Over the lifetime of our project, we may fill in multiple slices. But it may be that our circle is never fully finished (we didn’t need all the bells and whistles after all). It’s even possible, or perhaps likely, given our limitations on knowing the future, that we end up with something less like a circle and more like a shapeless blob.
With BDD, we can deliver just what we need when we need it. Nothing more.