How we implemented domain-driven development in Golang
Some learnings from Grab’s implementation of the principles of domain-driven development (DDD) and idiomatic Go.
- Work closely with business/domain experts to gather knowledge on the required functionality and flow of what you are building.
- Break down this knowledge into different problems that need to be solved. Categorize these problems into bounded contexts and subcontexts (read here to know more about it).
- Use these contexts to identify dependencies in the code & in the team. Identify the building blocks (value objects and entities) to further break down the functionality and flow.
- Create interfaces to abstract the working logic of a given domain (i.e. repository).
- Identify domain events and let them provide the relevant useful information to the user in other domains. This enables the independence of different classes.
- Use a common language developed with the domain experts and apply it consistently in discussions and coding (for instance, to name classes and methods).
Full post here, 5 mins read