The software development industry is still in its early days. Compared to other industries with centures of history and evolution behind them, software development is only beginning to mature. One of the consequences of that relative immaturity is that we still have many recurring problems to solve. In this article, I'm going to talk about one of the most important ones: communication.
The term, introduced by Gojko Adzic, refers to techniques that have in common the specification of software requirements using examples, as the name suggests. The most well known of these techniques is BDD, or Behavior Driven Development.
Essentially, these techniques tell us to describe the software using stories, with real case examples whenever possible, and to share those stories with the whole team. The recommendation is to involve the team in the writing, in fact, and use the stories to ascertain that the software really does what is specified. There is even a language created to make it easier (Gherkin) and tools like Cucumber and Specflow that make executable tests out of these specifications.
Most developers nowadays are familiar with the term BDD, or at least TDD (Test Driven Development). Many quality assurance analysts use it to write their tests. Business analysts also use the Gherkin language to describe the requirements. But the true power of Specification by Example comes when everyone works together, a technique known as The Three Amigos.
I will not go into details about how it works here - my intention is to show the benefits, leave some references, and let you try it out. I can assure you it will be worth it!
Specification by Example brings a lot of advantages with it. The first one is bridging the communication gap. The Gherkin language is made to be easy to read and can easily be understood by anyone in the team, even business people, without any knowledge of computer programming. Furthermore, the same specification can be used throughout the whole process by business analysts, software developers, and quality assurance analysts. Even the client can have access to the specification by using a tool like Pickles.
Test-driven development is a good way to test and self-document the software, but defining what to test is not always easy. In most cases, the developer will not know what is necessary to test, which in turn means the developer is left unsure as to what ought to be implemented.
The existence of a human readable specification, created by developers, business analysts and quality assurance analysts together, solves this problem by making it clear to the developer what must be implemented and what must be tested.
Another advantage of these techniques is that the specification is split into scenarios. Each scenario has a unique set of preconditions, a small set of actions, and expected postconditions. This way, it is easy to pinpoint what conditions are causing a test fail.
A specification created collaboratively makes everyone feel like part of the team, with shared responsibility for the end product. Now it’s not that guy s responsibility anymore, it’s ours. And we are going to make sure it’s correct and addresses the client needs.
Specification by Example is more than writing specification using examples. It demands the integration of the team, it results in executable tests, and ensures quality work. Without Specification by Example, these aspects are often overlooked, or never even considered.
What do you think about Specification by Example? How much of it have you tried? Leave your opinion in the comments. For those wanting to learn more about the subject, try reading the book Specification By Example, which chronicles the extensive research Gojko Adzic about this subject.