Shrek, Onions and Architecture - Katy Ereira

Discover how to build robust and maintainable software systems with Domain-Driven Design principles, separating layers, and bounded contexts, all while improving code readability and collaboration.

Key takeaways
  • Domain-Driven Design: Focus on the core domain model, encapsulating concepts and abstractions, and use interfaces to reference other layers.
  • Onions: Just like onions have layers, applications have layers that need to be separate and distinct, with clear boundaries.
  • Separation of Concerns: Divide the application into layers that are responsible for different functions, such as infrastructure, business logic, and presentation.
  • Ports and Adapters: Use ports and adapters to separate the business logic from the infrastructure, allowing for easy changes or replacements.
  • Bounded Contexts: Define bounded contexts to manage complexity and ensure that each context has its own set of rules and abstractions.
  • Entity: An entity is an object that has its own identity and can change over time, such as an employee with a changing address.
  • Value Object: A value object is an immutable object that represents a set of values, such as a date range.
  • Repository: A repository acts as a boundary between the business logic and the infrastructure, providing a layer of abstraction.
  • Management: Management is the process of defining and organizing the layers and abstractions within the application.
  • Testing: Test the application by asking questions and verifying the expected behavior, using techniques such as mocking and dependency injection.
  • Clean Coding: Follow clean coding principles to improve the readability and maintainability of the code, such as using descriptive variable names and concise code.
  • Ubiquitous Language: Use a ubiquitous language to communicate with the business stakeholders and ensure that everyone is speaking the same language.