Event Sourcing Design Pattern in a Java Enterprise Application

Abstract

Abstract

This diploma thesis provides general information about the Event Sourcing design pattern and principles of the closely associated CQRS (Command Query Responsibility Segregation) design pattern and their usage in the Java programming language. The aim of this thesis was to study these design patterns, apply them to a real-world software project in Java, and finally to describe the advantages and disadvantages of this design over the traditional architecture found in most enterprise Java projects.

Introduction

In software engineering and development, there are many problems the developers need to focus on to build a successful system. Many difficulties come early in the design phase of the software and developers had better have the knowledge and the proper tools to design and build the software, so it is successful, bug-free, maintainable, and usable. The trouble is that there is no single "right way", a silver bullet, which can be used universally in software development because of the complex nature of a domain that the projects usually solve. And of course, even experienced software developers cannot possibly know every problem the software can run into later in development.

However, a successful project --- that is a project built according to customers' needs, in time, and on budget --- does not say anything about the project internal code and design quality. The project, even if it works as required, may be very brittle to change in its internals and the code may be so complex that maintenance becomes very hard. This can result in the introduction of bugs into the code that are, consequently, difficult to find and fix. This situation usually happens in projects that need to respond to changing requirements.

Some of the problems turned out to be so common that they needed to be addressed in most of the projects, and so, over time, so-called patterns and best practices formed to help solve the problems, or, at least, diminish their effect. So, one of the best things software developers can have is the knowledge of these patterns and best practices that were already used and proven to work by someone else. This knowledge allows them to tackle some of these common problems while makin