Notes from - Writing idiomatic Go using Domain-Driven Design by Damiano Petrungaro

My notes from Damiano Petrungaro's presentation about Golang and Domain-Driven Design

Firmino
Firmino Changani

Rough notes. Please watch the original presentation.

  • DDD usually requires two approaches: Strategic Design and Tactical Design
  • Artifacts should be grouped by (business) context rather than by kind
  • When packages of different contexts need to communicate with each other, an Anti-Corruption layer can be introduced.

Packaging via bounded contexts

Tactical Design

  • Value Type (Value Object)
  • Repository Pattern
  • A domain struct should not be created with invalid state, nor should it be allowed to have its state invalidated during runtime.

Value-Type Pattern

A Value-Type is equivalent to the Value Object pattern in OOP languages.

Repository Pattern

  • Decouples the domain layer from the data layer. Should the data source change, the domain will not be impacted assuming it's using this pattern.
  • Facilitates testing without the need of a real database / service.

References

golanng ddd