Domain Driven Design as billiards game

DDD, development, fun Comments Off on Domain Driven Design as billiards game

I am becoming a fan of Domain Driven Design (DDD).

Here is a fun idea how DDD could look if you come to a pub to play a billiards game.

You are asked which game exactly you are going to play; so you say “pool”. As result you get a pool table and a pool rules agreement. This is an abstract factory.

The balls are numbered and colored. Black ball has a custom behavior. Since they all have an identity, they are entities.

As for the billiard cue — it’s a bit trickier. If the cues have different size, and you prefer to play by your own one, it’s an entity. Although, if you are drunk and don’t care about the stick you are playing with, it’s a value object.

A small pieces of chalk is a value object — any one works. The adjustment triangle is a value object too.

The rules of pool is a domain service.

The kick, the chalk break, the balls setup — all these form a infrastructure service.

A wall shelf for the balls is a repository.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in