DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Common Performance Management Mistakes
  • How To Use JMS ActiveMQ With Mule 4 - Part 6
  • Correlating Event-Driven Architecture and API-led Connectivity
  • AWS EventBridge as Your System's Nervous System: The Architecture Nobody Talks About

Trending

  • Bringing Intelligence Closer to the Source: Why Real-Time Processing is the Heart of Edge AI
  • Lambda-Driven API Design: Building Composable Node.js Endpoints With Functional Primitives
  • Ingesting Fixed-Width Mainframe Files Into Delta Lake: The Details Nobody Writes Down
  • Building Enterprise-Grade Real-Time IoT Dashboards with Vue 3, MQTT, and Kafka
  1. DZone
  2. Software Design and Architecture
  3. Microservices
  4. How BDD Works Well With EDA

How BDD Works Well With EDA

Learn how behavior-driven development and event-driven architecture can synergize.

By 
Peter Lawrey user avatar
Peter Lawrey
·
May. 22, 22 · Opinion
Likes (5)
Comment
Save
Tweet
Share
5.3K Views

Join the DZone community and get the full member experience.

Join For Free

Behaviour-Driven Development (BDD) and Event-Driven Architecture (EDA) work well together as they complement each other’s strengths and weaknesses. Using both can result in a shorter time to market for new functionality and a more maintainable system.

Behaviour-Driven Development encourages a common language between users and developers in describing requirements in a form the users can understand but can also automatically be checked as the application is developed and maintained. BDD increases the inclusion of users, focuses on requirements capture and maintains the velocity of development as the application increases in complexity.

Behavior-Driven Development

Figure 1. Behaviour-Driven Development for the high level with Test-Driven Development for the low level

Pros and Cons of Behavior Driven Development

Table 1. Pros and Cons of Behaviour -Driven Development

Event-Driven Architecture models interactions between services as events. Events are facts about something that happened representing a state change, such as an order placed or a payment processed, without implying which action if any must be taken, unlike request/response or actor patterns. EDA supports loosely coupled services, greater fault tolerance, and observable interactions between services can help minimise technical debt.

Example of an Event Driven Kappa Architecture microservice with feedback

Figure 2. Example of an Event-Driven Kappa Architecture microservice with feedback

Pros and Cons of Event-Driven Architectures

Table 2. Pros and Cons of Event-Driven Architectures

Regression Tests

When we came to design our kitchen recently, there were some things we knew we wanted, but couldn’t imagine the details. However, once we could see an initial design based on what we knew we wanted, we were able to get down to the details.

Designing applications can be similar. There are things we know upfront but there are other things we can only decide on once we see it come to life. EDA makes it natural to record what the application does do, in an easily observable way, and construct a test to ensure this behaviour doesn’t change. From the output of such a test, the user can see with each iteration, how they wish to customise the event processor or microservice, rather than having to specify all the details in advance.

Using known inputs and designed output to iteratively specify requirements

Figure 3. Using known inputs and designed output to iteratively specify requirements

How BDD and EDA Are More Effective in Combination

EDA naturally supports the recording and replaying of events produced by each microservice. EDA allows regression tests to be constructed and maintained easily with minimal input from end-users. While BDD benefits from responsive feedback from users, building regression tests can help in that process so users can see how they want to customise the behaviour. Utilising event-driven regression tests reduces the need for users to be always available to give feedback on incremental improvements.

BDD naturally supports the development of a common language between all microservices when microservices could quickly diverge without someone who can authoritatively say how things should be named. The common language can be referred to in code and kept consistent by having a shared schema of events and data transfer objects.

Simplified EDA used by a number of our customers

Figure 4. Simplified EDA used by a number of our customers

Recording the outputs of EDA microservices makes it easy to create test input data for new services. In many cases, you can start by determining the output events you need to produce and then recording the events produced by existing systems for the inputs. BDD can determine functionality requirements to turn inputs into outputs. Breaking this functionality into stages, you can construct the events that should occur at the stages in between.

Conclusion

We have used Behaviour-Driven Development to establish the application’s requirements from users, and Behaviour-Driven Development to automate testing to ensure the application meets those requirements as it is developed and changes are made to add more functionality. We believe this is a very effective way to build and maintain back end real-time software.

Event-Driven Architecture decomposes complex interactions into easily describable and testable components for real-time processing of streaming data.

Using both together provides a uniquely productive environment to deliver complex functionality.

Architecture application Event Testing

Opinions expressed by DZone contributors are their own.

Related

  • Common Performance Management Mistakes
  • How To Use JMS ActiveMQ With Mule 4 - Part 6
  • Correlating Event-Driven Architecture and API-led Connectivity
  • AWS EventBridge as Your System's Nervous System: The Architecture Nobody Talks About

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook