Domain Driven Data Oriented Design
Hybrid Meetup #40 took place 2024-01-30 at Basislager Leipzig and we had a great presentation by Bill Kennedy from Ardan Labs about Domain Driven Data Oriented Design. A recording of the talk is available at our YouTube Channel.
All code shown in the talk is available at: ardanlabs/service.
Just a few notes from the talk:
- CRUD is boilerplate
- domain-driven design comes with a cost but can help to keep larger projects structured and maintainable
- one way to limit data exposure per domain is to create a relational view per domain
- example of an opaque type from the repo is
user.Role
- it could be a string, but we limit its usage by using a parse function to ensure validity - code that reads code to generate docs: webapi.go
Thanks again to Bill for sharing his perspective on domain driven design and how it could be applied in Go.
Misc
- Go has first-class self-parsing support in the ast package, with the canonical example of code working on code being go fmt; in #36 we learned about encore.dev, which makes extensive use of the Go AST to infer and validate a complete service topology
- Parse, don’t validate (Haskell ahead) - how to use data structures to make illegal state unrepresentatable and more
- an opaque type for time in the standard library helped with switching the underlying implementation with the 2017 proposal for Monotonic Elapsed Time Measurements in Go - an issue that had grave effects: Other reported software problems associated with the leap second
Its [Cloudflare’s] DNS resolver implementation incorrectly calculated a negative number when subtracting two timestamps obtained from the Go programming language’s time.Now() function, which then used only a real-time clock source. This could have been avoided by using a monotonic clock source, which has since been added to Go 1.9.
CGMR and beyond
- on 2024-02-26, there will be an Intro to Go (golang) talk by Karl at webmontag Halle, at Mitteldeutsches Multimediazentrum Halle
- if you are in Hannover, Germany, check out Hannover Gophers