Intent-Driven Development – the hidden key to BDD
Intent-Driven Development. It’s not a new agile fad – it’s just articulating an approach that works well for a lot of experienced practitioners. Whether they know it or not.
When I train and coach development teams, I like to talk about Intent-Driven Development. Don’t worry – Intent-Driven Development is not the latest agile trend. Rather, it’s a way of articulating an approach that many more experienced agile practitioners find useful.
Articulating your intent – what are you trying to achieve?
Intent-Driven Development is simply about announcing your intent before you act. It is about expressing out loud what you intend to do, and what you think it will achieve, before you do it. This idea applies at many levels and underlies many agile and BDD ceremonies. Example Mapping and Feature Mapping workshops are classic examples of practicing Intent-Driven Development at a team level.
But in this article, I want to look at how Intent-Driven Development can help developers.
Written expression – not just for BAs
As developers, we are often not used to expressing our intent out loud. We would much rather dive into the code and start building something concrete, than waste our time talking. Too much thinking seems to slow us down, when we could be just getting on with it.
BDD and TDD practitioners know this is a trap. They know from experience that diving into the code does not get us where we want to go faster. All those silly little mistakes that we make when we dive into the code inevitably slow us down, break our flow, and distract us from the outcomes we are trying to achieve.
That’s why BDD and TDD practitioners like to express their intent before they code. They write down what they want to achieve, and why, in the form of a failing test. This helps them articulate what they are trying to achieve, and why. Behaviour Driven Development encourages an “outside-in” approach, where you start with articulating your high level goals in the form of an automated acceptance criteria. You then work your way into more detailed code and lower level tests, but at each stage, you express your intent as a failing test before you code. This helps you keep the end goal in mind: delivering the value expressed by the high level acceptance criteria.
Say it out loud
Even if you don’t express your intent as an executable specification at every level, you can still benefit from just saying what you intend to do out loud. Speaking aloud, or writing something down, crystallises our thought process. It makes us double-check that what we are saying makes sense. This is one of the reasons that pair programming is so effective at producing higher-quality code – you are vocalising your intent almost continually.
Speaking the same language
When we code, we often fall into the habit of tech-speak. We write code, intended for machines and not for other humans. There is a subtle disconnect between the code we write and the business domain we are working with.
But our code is less likely to contain mistakes if it is expressed in terms of the problems we are trying to solve. Fluent APIs, functional programming styles, and idea of a ubiquitous domain language all try to help us move in the direction of writing clearer, more meaningful code. But this all supposes that we take the time to articulate what we are trying to do, in business language. First you express your intent, then you document your intent in your code for all to see.
Intent-Driven Development is what a lot of experienced developers do naturally, although they might not have expressed it in those terms. It’s not hard to learn, and there are no new languages or APIs involved. Just express what you are going to do, before you do it. With a bit of luck, this will make you question why, and push for a better understanding of your goals. Try it out!
Related courses and workshops
If you are interested in learning more, or in learning how to introduce Behaviour Driven Development concepts to your own projects, be sure to check out our range of onsite BDD and Lean/Agile workshops.