Domain driven
design
Alexander Kudrin
First principle
“Our highest priority is to satisfy the customer
through early and continuous delivery
of valuable software.”
Agile Manifesto
Doom of your project
For what?
● Fast delivery
We want
● Separate code
● Reusable code
● Clear code & Understandable code
● Human resource scalable project
Big blue book
Domain & bounded context
Pizza startup: 4 Turtles & 1 Rat
Core domain
Dividing by roles
Context map
Subdomain structure
From: To:
Elephant
Task: Get a beer
Imperative: Declarative:
----------------------------------- -------------------------------------
1. Take 2 dollars I want something light,
2. Go to the shop at the crisp and refreshing.
corner With the fruit notes
3. Take 2 cans from the which remains in the
fridge background and not
4. White Budweiser overwhelming. Something
5. Or Stella Artois if not too hot and very
there is no Budweiser. drinkable. And little
bit cold.
Authorization system
The authorization system is responsible for identifying a particular user.
Entities:Docs example
User is characterized by:
● Name and surname
● Email, unique
● Phone
Processes:
● Check in - During the registration process, we create a new user, ask him to confirm his email and phone, authorize the user for 1 day
(during this time he is obliged to confirm the email and phone).
● Login In - the process of authorization, we write out to the user an authentication key for a month. Only a user with a verified phone and
email address can authenticate.
● Logout - After logging out, the user will need to log in again to access the system.
● Email Verification - The user's email comes with a link. Opening the link, the user reports that this is his email. The link is valid day.
● Phone Verification - A text message comes to the user's phone, answering which he confirms that this is his phone. The code is valid for a
day.
● Password Recovery - The user enters his email, a link comes to him, on which he will be asked to change the password. The link is valid
for 2 hours.
● Authorization on other domains - Using a depreciation key, we can access accounts on other domains. If the passkey does not match, a
redirect to the authorization page. If it successfully passed, the user will be redirected to the main page of the original domain.
Variative architecture
Representation layer
Storage layer
Gateway
Process layer
Value Object and Entity
Scenario
Interactor
Service
Collecting layer
Form
Full map
Ruby and DDD
https://lunapark.dev
Telegram - https://t.me/lunapark_dev