ArticleslgStudy

computer science

Behavior-driven development

Behavior-driven development is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Behavior-driven development rather than just read about it. In short: Behavior-driven development (BDD) is an agile software development method centered around collaboration between business and IT professionals that have a stake in finding a solution for a complex problem. The core objective is to achieve a shared understanding of the problem.

Key takeaways

  • Behavior-driven development belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Behavior-driven development to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Behavior-driven development from memory before moving on to harder problems.

Reference excerpt

Behavior-driven development (BDD) is an agile software development method centered around collaboration between business and IT professionals that have a stake in finding a solution for a complex problem. The core objective is to achieve a shared understanding of the problem. BDD involves use of a domain-specific language (DSL) using natural-language constructs (e.g., English-like sentences) that can express the behavior and the expected outcomes. BDD encourages collaboration among developers, quality assurance experts, and customer representatives in a software project. It encourages teams to use conversation and concrete examples to formalize a shared understanding of how the application should behave. BDD is considered an effective practice especially when the problem space is complex. A common misconception regarding BDD is that it supposedly is a refinement of test-driven development (TDD). While it was originally derived from TDD practices, the sole purpose of BDD is to gain a shared understanding of the problem space and find a way to write this down in a Business Language, using Real data, whilst being Intention revealing, Essential and Focused (BRIEF). BDD combines the techniques of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software development and management teams with shared tools and a shared process to collaborate on software development. At a high level, BDD is an idea about how software development should be managed by both business interests and technical insight. Its practice involves use of specialized tools. Some tools specifically for BDD can be used for TDD. The tools automate the ubiquitous language.

Overview BDD is a process by which DSL structured natural-language statements are converted into executable tests. The result is executable specification eventually forming Living Documentation: Requirements that are also the first acceptance tests that drive your software development (Acceptance test-driven development). BDD focuses on:

Collaboration between business and technical people Creating a shared understanding of the problem that needs solving and how to solve this (without including any details on a chosen technical implementation yet) Writing this down in an unambiguous, precise way so that it can become executable specifications Starting from this point, many people developed BDD frameworks over a period of years, finally framing it in terms of a communication and collaboration framework for developers, QA and non-technical or business participants in a software project.

Principles BDD suggests that software tests should be named in terms of desired behavior. Borrowing from agile software development the "desired behavior" in this case consists of the requirements set by the business — that is, the desired behavior that has business value for whatever entity commissioned the software unit under construction. Within BDD practice, this is referred to as BDD being an "outside-in" activity. TDD does not differentiate tests in terms of high-level software requirements, low-level technical details or anything in between. One way of looking at BDD therefore, is that it is an evolution of TDD which makes more specific choices.

Behavioral specifications Another BDD suggestion relates to how the desired behavior should be specified. BDD suggests using a semi-formal format for behavioral specification which is borrowed from user story specifications from the field of object-oriented analysis and design. The scenario aspect of this format may be regarded as an application of Hoare logic to behavioral specification of software using the domain-specific language. BDD suggests that business analysts and software developers should collaborate in this area and should specify behavior in terms of user stories, which are each explicitly documented. Each user story should, to some extent, follow the structure:

Title An explicit title. Narrative A short introductory section with the following structure: As a: the person or role who will benefit from the feature; I want: the feature; so that: the benefit or value of the feature. Acceptance criteria A description of each specific scenario of the narrative with the following structure: Given: the initial context at the beginning of the scenario, in one or more clauses; When: the event that triggers the scenario; Then: the expected outcome, in one or more clauses. BDD does not require how this information is formatted, but it does suggest that a team should decide on a relatively simple, standardized format with the above elements. It also suggests that the scenarios should be phrased declaratively rather than imperatively — in the business language, with no reference to elements of the UI through which the interactions take place. This format is referred to in Cucumber as the Gherkin language.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Behavior-driven development

Start with the simplest possible case. Write down what Behavior-driven development claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Behavior-driven development before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Behavior-driven development ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Behavior-driven development

In research
Behavior-driven development appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Behavior-driven development in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Behavior-driven development is common in secondary-school and first-year university syllabi. It links to neighbouring topics Software design, Software development philosophies, so understanding it makes those chapters shorter.
In everyday life
Look for Behavior-driven development outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Behavior-driven development” →

How to study Behavior-driven development in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Behavior-driven development means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Behavior-driven development out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Behavior-driven development in simple terms?

Behavior-driven development (BDD) is an agile software development method centered around collaboration between business and IT professionals that have a stake in finding a solution for a complex problem. The core objective is to achieve a shared understanding of the problem.

Why does Behavior-driven development matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Behavior-driven development?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Behavior-driven development.

Tags

  • Software design
  • Software development philosophies

Keep exploring