Clean Architecture vs Domain-Driven Design (DDD) - Understand the Difference

preview_player
Показать описание
In todays video, we'll talk about CA vs DDD.
Although they are often used together, they are actually completely different things. In this video we'll break down what the Clean architecture is, what Domain-Driven Design is, and what is the difference between them.

Connect with me on 'em socials: 

Check out all my courses on DomeTrain: 

Support the channel and get the source code:

Thanks for watching, don't forget to like & comment & subscribe! ❤️ 💻
Рекомендации по теме
Комментарии
Автор

"Repositories go into either the application or domain layers" I believe their implementation goes into the infrastructure layer, but their definition (if you're working with interfaces/headers/protocols) belongs to the domain layer. This keeps the domain from being dependent on the infra layer, while still making use of it, often through dependency injection

maxweinbrown
Автор

you've been engagement'd! Loving the fresh vods lately - keep 'em coming!

kmcdo
Автор

Awesome work and material!

I've got some feedback on things that may be misleading in the video:
The DDD book (that picture you put in the video) does not speak about event-storming or any tooling to do the domain design itself.

The layers shouldn't call outwards (as you showed on application layer), they should only call inwards.
So that domain can't call application, application can't call presentation...

"Business logic" that you mention speaking about the domain layer is a bit cryptic, as it's not only about logic and "business" word is also not on point since what database you choose, how you call your database etc. at the end is also part of the business. There may be a point in your design (especially at the beginning, but depends on the problem you are trying to solve) that indeed it is a detail, but all of that is part of the business. The more important part is that through design you are able to better decide what can be postponed and what needs to be done right now.

So the "domain" layer is more about separating what's the language and concepts that stakeholders use (experts, business people, devs..) and separating it from technical decisions and other parts of the codebase.

And here we could say that calling a database is separate from that language, although it's part of that business, but it's a part we don't need to exchange. They won't care if we use postgress or datomic and we do a query with that and that syntax, it's not something worth communicating over. Even though it is part of our business as it can affect performance, security of the data and so on.

So in short:
Architecture (so many names...) is just a type of software architecture, structuring of the code and its relations that is advised to use with DDD as it helps separate the domain

DDD is about bringing all stakeholders (business people, developers, designers, experts...) to talk together and plan the software that is going to be made, which should result in code reflecting better it's intent, reducing misalignment between "business people" requirements and technical teams and enable better cooperation for future (easier applying changes, easier to exchange on topics, more accurate estimations...)

mateuszmazurczak
Автор

Good way to start the week, thanks so much!

FalcoSparverius
Автор

This was one of the key points in my latest video too. This common misunderstanding is very widespread and one of the major reasons why people tend to struggle with understanding software architecture in general.

Codewrinkles
Автор

Hey Amichai thanks for your explanation it is clear!

ferventurart
Автор

Many thanks for the video and expecting more :)

MehediHasan-xdrj
Автор

I really like these videos because Amichai talks about the more advanced concepts that are not covered anywhere else on the internet. Because in todays market of developers, you are not getting hired with your typical self-taught You-Tube education. Your projects are going to need some complexity to showcase that you are not just some code-monkey, or react-andy. Before these videos I could not map a domain to schema, or had any idea on to create a domain to begin with. I feel like I had that level of professionalism to my projects needed to get noticed by employers. I think the only thing I have not seen on the internet is how domain events are implemented together with something like Mass Transit or RabbitMQ. Excellent explanation of how separation of concerns synergizes with battle tested patterns and architectural principals to produce quality code.

tanglesites
Автор

Agreed what you just said. Also, it's required to understand that DDD != CA.
I have seen people claim they have done DDD because they have implemented CA. Which is wrong.
DDD can be used to model your problem domain but it should not influence CA.
A tactical design decision tree can be used to identify business logic patterns and architecture patterns based on the subdomain identified (supporting, generic, and core)

ransandu
Автор

it would be really good if you can show an example project.

Moosa_Says
Автор

God bless your heart Amichai. Struggled with the relationship between both concepts for quite a while now

danielolajumoke
Автор

Thanks for your videos, Amichai.
My question will sound very specific but who knows... In my industry, experts are referring to real-world objects as "manufacturable" and "manufactured". But the current codebase refers to the corresponding entities as "manufacturableMachine" and "manufacturedMachine". Is there any recommendation on using either language in the codebase? The actual spoken terms, or more formal terms? Or if there is any kind of standard regarding this question, is it bothersome that the words used to refer to these entities are adjectives or past participles?

zggydhy
Автор

Really interesting concepts, sometimes it's good to get away from the code and look at the actual concepts.

Radictor
Автор

I feel like this is always explained a bit differently, as originally, the domain layer would contain all interfaces and definitions, and the application layer would implement them in the usecases. so strictly speaking the business "code" is in the application, while the domain only describes, but has no logic, however sets the domain language.

RogerValor
Автор

You can’t make me understand. I refuse to

marrowfreeze
Автор

Really good vid. However, I kinda got confused when you started talking about the Application layer. Why do you have the application layer talking to the Infra layer? I thought the application layer can only communicate with the domain layer.

knightmarerip
Автор

from your courses would u suggest viewing the DDD before the Clean Architecture?

unhandledexception
Автор

May we say that DDD, is when you develop little framework before for the specific application?

serb
Автор

Can you issue a video code to realize the use of the warehouse layer and factory?

AlfredNing
Автор

hi, is the content of the video included in one of your dometrain courses? thanks!

richaaa_.m