Talk from Andrew Hao at Rails Conf 2017.
What Makes a System Beautiful?
- Language: syntax, form, expressiveness
- Tooling - developer ergonomics
- Tests - test practices and coverage
- Longevity - it can stand the test of time with changing business/product requirements
Deconstructing a Monolith
- Microservices are challenging
- How much should be extracted?
- What if I extract something that's too specific? Too generic?
Domain Driven Design
"Domain-driven design (DDD) is an approach to software development for complex needs by connecting the implementation to an evolving model."
- Integrating a ubiquitous language
- Develop a glossary of common terms and standards to follow so all team members are speaking the same language
- Rename code components to follow the glossary rules
What the business does that makes it unique.
Supporting roles that help to make the core domain happen.
After defining the core and supporting domains, identify them in the ERD diagram.
- Rails engines
- Rails app
- Separate app or API
- A running software system (codebase or app)
- Where concepts live (or are contained)
Bounded context allows us to have concise language.
Overlay bounded contexts
- Draw lines around system boundaries/bounded contexts
- View how components are segmented
- Draw out dependencies based on how the components communicate with each other
The goal: Each domain should have its own bounded context. (aka should be highly cohesive and loosely coupled)
Break Components Into Domains
Removing god objects with Aggregate Root
- Simplify the outside interfaces
- Only expose aggregate roots (direct method calls, JSON data, API endpoints)
- Build a service object that creates the aggregate root. Could be a query, struct, etc.
- Wisper gem for publishing domains
- Utilizes command objects
By leveraging active job, you can have domains communicate with each other via async. You can also integrate tools such as RabbitMQ for managing the message bus.
- Incrementally migrate features into domains
- Could migrate domains into microservice components
- Works with large systems
- Complex domain
- Large team
- Outside teams