Bowling game kata: a challenge for event sourcing
Event sourcing is a concept in software development that is gaining more and more importance. The idea is that all changes to a system are stored as events. This makes it possible to reconstruct the state of a system at any point in time. The challenge here is to put this concept into practice while finding a solution that is efficient and scalable.
The Bowling Game Kata is an exercise task that is perfect for practicing event sourcing. The goal of the kata is to implement a class that represents the scoring system of a bowling game. The idea is that all events, such as.B. The addition of a ball or the scoring of a strike, are saved.

When implementing the Bowling Game Kata with Event Sourcing, many obstacles are encountered. For example, a strategy must be found to efficiently access the current state of the system. Also, handling events that occur in the wrong order is a major challenge.
In this series of articles, we will address these very challenges and present a solution for implementing the Bowling Game Kata with event sourcing. We will explore different approaches for their advantages and disadvantages and show how they can be implemented in practice.
Background of the Event Sourcing Challenge: Bowling Game Kata
The Event Sourcing Challenge: Bowling Game Kata is an exercise performed by developers to improve their event sourcing skills. In event sourcing, each system state is mapped as a sequence of events, allowing changes in the system to be tracked. The Bowling Game Kata is a specific exercise that involves implementing a bowling score-tracking system using event sourcing.
This challenge should enable developers to understand and appreciate the benefits of event sourcing, including the ability to improve data precision, scalability, and reusability. In addition, developers will be able to improve their skills in using various tools, languages and frameworks to effectively implement the system.
Event sourcing is an advanced technology used in many industries, including financial and retail applications. The ability to accurately track and understand system events can help identify problems and eliminate inefficiencies. Bowling Game Kata is a great opportunity for developers to improve their skills in using this advanced technology and gain valuable experience.
- Keywords: event sourcing, bowling game kata, system state, events, scalability
Description of the kata
The Bowling Game Kata is an event sourcing challenge that involves implementing a simple bowling simulation. The goal is to store and update the current score as well as an overview of previous throws. The implementation should be done in a way that allows reconstructing the entire course of the game and undoing changes to rolls already made.
The kata is a great way to get started with event sourcing or as an exercise to improve your skills in using it. The implementation of the solution requires the understanding of concepts such as aggregates, events and read models.
The bowling game kata is available in different difficulty levels and can be customized. A possible approach is to extend the kata with additional requirements, e.g. B. the calculation of strike and spare bonuses or the management of team scores in multiplayer scenarios.
Implementation
The implementation of the Bowling Game Kata requires the consideration of several aspects. First, the events that represent the state changes must be defined. Second, an aggregate must be created that meets the logical requirements of the kata.

One possible implementation of the aggregate is to store the current game state and all previous throws in a list of events. By applying the events, the state of the game can be reconstructed and changes can be made to previous throws.
In addition, a read model can be implemented that calculates and displays the current score in real time. This can be done by evaluating the events and allows the score to be updated quickly for each new throw.
Benefits of Event Sourcing
- Event sourcing enables robust and fault-tolerant storage of data.
- It allows easy reconstruction of the state at any point in time.
- By using events, changes to actions that have already been performed can be undone.
- It allows for high flexibility in scaling systems.
- Event sourcing supports iterative and incremental development of applications.
Event Store: The Solution for the Event Sourcing Challenge: Bowling Game Kata
The Event Sourcing Challenge: Bowling Game Kata is an exercise designed to demonstrate the concept of event sourcing and its benefits to developers. Event sourcing is about capturing any change in the state of an application as an event that can be stored and later retrieved. The challenge is to create an application that manages the score of a bowling game.
An event store is required to successfully complete this challenge. An event store is a database specifically designed for use with event sourcing. Instead of storing the state of the application directly in the database, the events that led to changes in the state are stored.
By using an event store, a complete history of a system’s events is created. This means that developers can retrieve the past state of an application at any time. In addition, an event store provides the necessary foundation for implementing a command query responsibility segregation (CQRS) architecture that distinguishes read and write accesses.
In summary, an event store is an essential tool for developers working with event sourcing, especially in the Event Sourcing Challenge: Bowling Game Kata. It provides a complete history of events and lays the foundation for an effective CQRS architecture.
Implementation of the Event Sourcing Challenge: Bowling Game Kata
Implementing the Event Sourcing Challenge: Bowling Game Kata requires careful planning and implementation. Here, event sourcing is based on the idea that all changes to the system are captured as events. Each event is stored as an immutable object and can be used later to reconstruct the system state.
This approach makes it possible to track the history of the system and roll back changes. When implementing the bowling game kata, the events during the game must be captured and stored. Various technologies such as the event store database or Kafka can be used for this purpose.

Another important aspect of the Bowling Game Kata implementation is the correct calculation of points. This requires accurate tracking of game actions as well as efficient and correct implementation of scoring rules.
To overcome the challenges of this implementation, the use of test-driven development techniques and the integration of continuous integration and continuous delivery practices can be useful. Comprehensive planning and implementation can successfully overcome potential challenges in implementing the Bowling Game Kata.
Conclusion
The Event Sourcing Challenge is a challenging potential exercise for developers who want to improve their skills in dealing with concepts such as event sourcing and domain driven design. The implementation of the Bowling Game Kata gives the opportunity to deepen the understanding of these concepts and to test them in practice.
The main challenge lies in implementing the various components to realize event sourcing. Here, developers must demonstrate their skills in using programming languages, frameworks, and databases. The equally challenging implementation of appropriate test cases completes the challenge.
However, the Event Sourcing Challenge is not just a technical competition. It also requires a certain amount of creativity and imagination to grasp complex processes and relationships and translate them into reality. In the end, there is a satisfying result that has internalized the most important concepts of event sourcing and can thus be transferred to future projects.
In summary, the Bowling Game Kata as part of the Event Sourcing Challenge is an asset to any developer looking to gain in-depth knowledge of event sourcing and domain driven design. Although the challenge can be demanding, it still offers plenty of potential for further development, culminating in a satisfying success.