Is Domain-Driven Design (DDD) and Domain-Centric Design the same?!

Is Domain-Driven Design (DDD) and Domain-Centric Design the same?!

Sunday, April 21, 2024 Software Design Approaches

They are related concepts but have different focuses and approaches, let's detail it with examples.

Domain-Driven Design (DDD):

  • DDD is like building a house that perfectly fits the land it's on. Instead of just building any old house, you design it based on the shape and size of the land. Similarly, in DDD, developers design software to perfectly fit the "land" of the problem they're solving.
  • It's all about teamwork! Imagine you're making a video game. The people who know the game best are the players, right? DDD says, "Let's work closely with those players to make the game awesome!"
  • DDD gives us special tools and rules to help us build our software correctly. It's like having a blueprint for our house so we don't accidentally put the kitchen where the bedroom should be.
  • In DDD, we use fancy words like "bounded contexts" and "aggregates," but all they mean is that we break down our problem into smaller, manageable pieces. It's like how you'd break down a big homework assignment into smaller tasks.
  • Lastly, DDD teaches us to speak the same language as our "experts." If we're making a game about space, we need to talk like astronauts, not like chefs. This way, everyone understands what we're doing!

Domain-Centric Design:

  • Domain-Centric Design is a bit like saying, "Hey, let's make sure our house matches the neighbourhood it's in!" Instead of just focusing on one house, we think about how it fits into the whole neighbourhood.
  • It's not just about DDD; it's about any way we can make sure our software fits the problem we're solving. Maybe we use some DDD ideas, but we're open to other cool tricks too!
  • When we say "domain-centric," we mean we're putting the most important thing first: the problem we're solving. It's like saying, "Let's make sure our video game is fun and exciting, no matter what."
  • So, in simple terms, DDD is a specific way to build software that matches the problem perfectly, like a house on its land. Domain-Centric Design is like making sure all the houses in the neighbourhood look great together, focusing on the problem above all else.

Imagine you have a Personal Finance application with only three core features including Expenses Tracking, Budget Tracking, and Income Tracking, then then DDD Solution structure can be: 

Domain/
|-- Model/
|   |-- Expense/
|   |   |-- Expense.cs
|   |   |-- ExpenseRepository.cs
|   |   |-- ExpenseService.cs
|   |-- Budget/
|   |   |-- Budget.cs
|   |   |-- BudgetRepository.cs
|   |   |-- BudgetService.cs
|   |-- Income/
|   |   |-- Income.cs
|   |   |-- IncomeRepository.cs
|   |   |-- IncomeService.cs
|-- Shared/
|   |-- Kernel/
|   |   |-- Entity.cs
|   |   |-- ValueObject.cs
|   |-- Utilities/
|   |   |-- DateTimeProvider.cs
|-- Application/
|   |-- Services/
|   |   |-- ExpenseAppService.cs
|   |   |-- BudgetAppService.cs
|   |   |-- IncomeAppService.cs
|-- Infrastructure/
|   |-- Persistence/
|   |   |-- ExpenseRepositoryImpl.cs
|   |   |-- BudgetRepositoryImpl.cs
|   |   |-- IncomeRepositoryImpl.cs
|   |-- ExternalServices/
|   |   |-- EmailService.cs
|-- Presentation/
|   |-- Controllers/
|   |   |-- ExpenseController.cs
|   |   |-- BudgetController.cs
|   |   |-- IncomeController.cs

while the Domain-Centric Design's solution structure can be:

Features/
|-- ExpenseTracking/
|   |-- Expense.cs
|   |-- ExpenseRepository.cs
|   |-- ExpenseService.cs
|   |-- ExpenseController.cs
|-- BudgetTracking/
|   |-- Budget.cs
|   |-- BudgetRepository.cs
|   |-- BudgetService.cs
|   |-- BudgetController.cs
|-- IncomeTracking/
|   |-- Income.cs
|   |-- IncomeRepository.cs
|   |-- IncomeService.cs
|   |-- IncomeController.cs
|-- Shared/
|   |-- Utilities/
|   |   |-- DateTimeProvider.cs
|-- Infrastructure/
|   |-- Persistence/
|   |   |-- ExpenseRepositoryImpl.cs
|   |   |-- BudgetRepositoryImpl.cs
|   |   |-- IncomeRepositoryImpl.cs
|   |-- ExternalServices/
|   |   |-- EmailService.cs
No comments yet
Search