Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tonqa authored Aug 16, 2024
1 parent 830d6e4 commit 9b54462
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Design goals

The soda machine is a web app, which utilizes the method of Domain-Driven Design (DDD) of Eric Evans. The goal of this project is to show how the out-of-the-box tools of Spring can be used to make a proper clean domain model in DDD.
The soda machine is a web app, which utilizes the method of Domain-Driven Design (DDD) of Eric Evans. The goal of this project is to show how the out-of-the-box tools of Spring can be used to make a proper clean domain model in DDD. DDD is a modeling technique, where a domain model is the edge of the application.

### In detail

Expand All @@ -28,6 +28,32 @@ Soda machine is based on the hexagonal architecture. This architecture style use

![Hexagonal architecture is used for the application](hexagonal.png)

### Domain model

The application is organized by the following aggregates:

* **Automaton**: On each start an automaton is created, which can be switched on and off
* **Recipe**: Holds the recipes with its ingredients, e.g. black coffee, white coffee, milk and soda
* **Price**: Hold the prices of each of the recipes in Cent, which is dependant on a separate priceId
* **Selection**: Holds the selected recipes of each automaton and if selecting recipes is possible
* **Pay**: Holds the inserted coins in a money slot and the register of the automaton
* **Mixing**: Holds the Mixer state and the inventory boxes with their fills (like a coffee, milk or soda box)
* **Display**: Holds the output messages of each automaton, which is displayed to the UI
* **Trace**: Traces all the events in the application and prints it to the console

E.g. a `Display Message` aggregate looks like this. It extends the `AbstractAggregateRoot` interface, is annotated by `@Entity` and has a message Id annotated by `@EmbeddedId`. It contains domain methods like `sendToWebsocketPort(Port)` and registers events via `registerEvent(Event)`, which are fired on persistency.

```java
@Entity
@Data
@EqualsAndHashCode(callSuper = true)
public class DisplayMessage extends AbstractAggregateRoot<Message> {
@EmbeddedId
private MessageId id;
private String message;
}
```

### Event model

The event flow was created using the event-storming method of Alberto Brandolini, which helps to properly design the application events upfront in an unobtrusive way by using events as the first-class citizen.
Expand Down

0 comments on commit 9b54462

Please sign in to comment.