Cheddar is a Java framework for enterprise applications on Amazon Web Services (AWS) using domain-driven design (DDD).

Introducing Cheddar, a Java framework for domain-driven design applications

Matthew Steer -  23 Sep, 2014

We're excited to announce the release of Cheddar, our first Open Source project. You can find it over on Github.

Cheddar is a Java framework for enterprise applications on Amazon Web Services (AWS) using domain-driven design (DDD). Bounded contexts are implemented as microservices, which, are integrated using an event-driven architecture, and expose a REST API. Cheddar has full AWS integration using native services such as SQS, SNS, DynamoDB and CloudSearch.

Domain Driven Design

Domain-Driven Design (DDD) is an approach for developing software that closely aligns the implementation to evolving business concepts.

DDD promotes focus on the subjects most important to the business problem at hand, identifying these as core domains. Complex systems are decomposed to several orthogonal domains using strategic modelling, avoiding cross-contamination and enabling modelling of relationships between domains.

To talk about the domain, a domain model and supporting ubiquitous language is used. Domain experts use the ubiquitous language every day when talking about the domain. The ubiquitous language and domain model form the basis for a solution that addresses the domain, known as a bounded context. A rich domain model encapsulates all its domain (business) logic.

Domain models publish domain events when something of potential interest occurs in the model. Domain events may be consumed by the local or (after mapping by an anti-corruption layer) foreign bounded contexts. This application of the observer pattern promotes decoupling of the domains.

Practical concerns irrelevant to the domain but vital for a working implementation, are kept out of the domain, such as persistence, security and transactions.

By modelling the business in software, DDD enables building of flexible, scalable solutions tightly aligned with business goals.

Cheddar applications

Cheddar provides a well-defined Java project structure for implementing each bounded context as a REST HTTP application hosted on AWS.

Hexagonal architecture

Cheddar uses a hexagonal architecture to house each bounded context, an application layer and an adapter layer surround the domain model.

Domain model

Central to the implementation is the domain model, containing rich domain objects, repositories and supporting domain services. All domain logic belongs in the domain model.

Application layer

The application layer is responsible for co-ordination of operations performed on the domain model, application of security and transaction boundaries. The public interfaces for the application layer form the API for the bounded context. This API satisfies the use cases for the bounded context. No domain logic resides in the application layer.

Adapter layer

The adapter layer adapts all communication for the bounded context, both inbound and outbound. It abstracts technical detail for various communication forms:

  • Messaging using SQS
  • Persistence using DynamoDB
  • Multiple data versions and formats
  • RESTful web services

The adapter layer is also responsible for mapping between foreign concepts outside the bounded context and the native ubiquitous language inside.

The adapter layer maps between data types present in the APIs and a canonical data model (CDM). The CDM is shared by all bounded contexts and is authored using XML Schema. The REST resource representations are defined using types defined in the CDM.

Event-driven architecture

The bounded contexts are integrated using a loosely coupled event-driven architecture. The adapter layer supports this integration by implementing event messaging via SQS and SNS.

Cheddar software stack

Each bounded context is packaged as a standalone Java application, and should be deployed on a dedicated AWS EC2 instance (multiple application instances will be supported in future). Grizzly and Jersey are used as the basis for the REST HTTP server application. Cheddar provides a driver package for application clients (currently only Java is supported), but any client capable of consuming REST services can easily work with Cheddar applications.

Get involved!

Cheddar applications are already out there in our production environment running some of the core microservices that underpin our award winning Travel Cloud, and over the coming months our entire platform will transition to Cheddar.

There's still a lot we want to achieve with Cheddar, hence the framework is under constant development. You can find out more about our plans and get involved yourself by visiting the Cheddar page on Github.

Subscribe to this blog

Use of this website and/or subscribing to this blog constitutes acceptance of the travel.cloud Privacy Policy.

Comments