Duse XIV at Lunatech Research

04 October 2011

Francisco Canedo

by Francisco Canedo

Lunatech Research is proudly hosting the fourteenth Duse meetup, a fun gathering of developers interested in Scala.



  • 18:00 - 18:30: Food & Drinks

  • 18:30 - 21:00: Presentation Event Sourcing & Discussion

The number of attendants is limited to 30, please register at the Duse website.

The outline of the presentation:


Give the audience an understanding of how event sourcing is both easy to implement and can simplify the structure of your business application (with code provided)


Currently many business applications are developed using a very database centric approach, often requiring the use of complex tools like Object-Relational Mappers (ORMs). Although ORMs can make developers more productive the core issues remain:

  • Lack of modularity due to coupling to the relational model

  • Tight coupling to the used ORM and/or underlying database, making it unnecessarily hard to use alternative (NoSQL) or multiple databases

  • Complexity of the ORM makes it hard to fully understand the behavior of the application

  • Mutability is in-grained, reducing the possibilities for composition

  • and modularity

  • Limited possibility for abstraction, due to limitations imposed by the ORM on used data types, etc.

In this talk we’ll explore the use of an alternative approach using the techniques pioneered by Greg Young using Domain-Driven Design (DDD) and especially Command-Query Responsibility Segregation (CQRS): Event Sourcing.

By making change explicit through the use of domain events the developer is put back in charge of the application, instead of the ORM.

Traditional languages such as Java require a lot of ceremony when implementing event sourcing, obscuring the basic simplicity. Using Scala’s flexible syntax, light-weight classes, and immutable data structures very little support code is needed to build production ready applications. We can start simple and scale up to more complexity only when we need to. During this talk we’ll take a quick tour through the code you might need to get started.

The goals are to make developers productive while keeping applications understandable and maintainable. This is achieved by:

  • Separating infrastructure from your domain code

  • Manage complexity in a scalable manner. Simple functionality ("CRUD") is easy to implement, while allowing a clear path towards complex behavior and implementation

  • Predictable and high performance

  • Simple, clearly delineated application components that interact through well-defined interfaces, for both infrastructure and domain code

Some of these concepts were first explored in a series of blog posts (see http://blog.zilverline.com/2011/02/10/towards-an-immutable-domain-model-monads-part-5/).