DDD is just giving a $h!t about your Domain

  Рет қаралды 16,383

CodeOpinion

CodeOpinion

Күн бұрын

Пікірлер: 55
@justgame5508
@justgame5508 Жыл бұрын
The issue with these examples is it’s virtually impossible to learn WHY things are dove a certain way in DDD without going through the issues they solve yourself. I tried to refactor our systems code base to a DDD vertical slice architecture, I made some good decisions, but their were times I was just lost. I didn’t know what the “proper” technique to use was. Eventually I settled in a middle ground between things that suited our needs and stayed in line with things I’d been reading up on. As we’ve added new features and learnt more about our system, the questions I didn’t have an answer to “why do it this way, why is so and so bad” become obvious. There is no way to genuinely learn this stuff without trying, failing, improving and trying again. Currently our system is screaming out for a event driven architecture approach, I was oblivious to this when we first planned it (wasn’t me actually was a dev who has since left) but now I’m find myself thinking “that solution would be so much more efficient and elegant with an event based system”. I’m sure I’ll fail, learn and improve plenty on this endeavour too
@Greenthum6
@Greenthum6 Жыл бұрын
Sample application stack: .NET, serverless, event sourcing with CQRS, microservices architecture, integrated CI/CD pipeline, edge node globally hosted UI with Blazor WASM authenticated with Azure AD and styled with MudBlazor. The application & business domain: TodoList containing TodoItem, which has Name and IsChecked properties. Full feature list: Add/Update/Delete items
@flobuilds
@flobuilds Жыл бұрын
In defense... If implemented correctly, it would propably scale to the moon 😂
@CodeOpinion
@CodeOpinion Жыл бұрын
Exactly.
@Greenthum6
@Greenthum6 Жыл бұрын
@@flobuilds Yes, you must be prepared when the business folks require changing the database engine. AGAIN.
@flobuilds
@flobuilds Жыл бұрын
@@Greenthum6 maybe a change to cassandra or scylladb ☠️
@MrBlubberjam
@MrBlubberjam Ай бұрын
Disagree. If an application should only be as complex as necessary, this is using a wrecking ball where a hammer would suffice. So would not convey the benefits of DDD but rather why this would be over-engineered for the use case. DDD practices would help recognise that expansion would require change, and separation where necessary to form new domains. A to-do list can't convey that step in discovery. A finished solution of the evolution won't convey how you got there, and so the lessons of DDD would be lost.
@drewjaqua2905
@drewjaqua2905 Жыл бұрын
I watched this a while back or maybe I didn't and I'm thinking of one of your other videos, but I laughed out loud because I thought of all the "Building a TODO List: an introduction to domain driven development" tutorials I've seen out there. You hit the nail on the head when you said that sample projects do more harm than good.
@onistag
@onistag 5 ай бұрын
No kidding! I was just thinking about the many todo list repos I've seen that are so insanely complex for NO reason but to show the pattern. It's such an awful way to learn patterns.
@brandonpearman9218
@brandonpearman9218 Жыл бұрын
Agreed but I find that most developers want to choose a pattern and apply it everywhere regardless of complexity or use case for consistency. So if one model has extreme complexity but another doesnt, generally I see the implementation is done as both being domain models or none. most devs wouldnt have 1 domain and 1 script. Whats your opinion on that?
@CodeOpinion
@CodeOpinion Жыл бұрын
Ya, very much agree that's pretty common. I understand why because of varying degrees of experience and skill and often reasons why that happens. Force people down a road to conform to the "here's the way we do it" so there's going offside incorrectly. I get it. However, you can be making things more difficult in the long run because of it. Hence why I get comments about "I have to change 5 layers to make a single change" when something is purely CRUD.
@PaulSebastianM
@PaulSebastianM Жыл бұрын
There are also degrees to patterns. For example you can use Value Objects and Entities but not Aggregates because maybe you prefer Transaction Scripts in maybe something like a service or right in your MVC API controller. That is not real DDD but some DDD patterns are hard not to see the urge to apply almost everywhere, especially in classic enterprise apps.
@bobbycrosby9765
@bobbycrosby9765 Жыл бұрын
The maddening thing about toy examples is it's not hard to to think up domain complexity. Also, people writing an example could pick a domain they have some knowledge about and not handwave all the complexity away. I worked on a project a while back that was really good for this: it was a pretty small domain but the interactions were complex. So when I test things out I like to use that domain as a test bed of sorts.
@nove1398
@nove1398 Жыл бұрын
I like this explanation about the samples being too simplistic to properly demonstrate the concept that needs to be learned.
@JeffryGonzalezHt
@JeffryGonzalezHt Жыл бұрын
A non-trivial part of my work is teaching, which is to say that I write "worthless" reference applications for a living. And I can't agree more. There is no suitable example, reference, or canonical domain model that is separate from the aggregated learning of the team that discovered/built it over the life of the application. Write tests, deliver stuff frequently, iterate. You will end up with your own special unique snowflake.
@majormartintibor
@majormartintibor Жыл бұрын
I can't even express how much I agree with you Derek. Perfectly put!
@majormartintibor
@majormartintibor Жыл бұрын
oh and btw, that repo you looked at belongs to a coworker of mine. I am currently actively teasing him in our teams channel xD
@CodeOpinion
@CodeOpinion Жыл бұрын
It's not a bad thing as an author to go through those motions, but as an outsider with no context, just looking at the code, it can be for the reasons I outlined.
@CrapE_DM
@CrapE_DM 2 күн бұрын
Yeah, I've hated how much people demonstrate DDD and Event Sourcing with basic CRUD setters
@ChickenMaster7
@ChickenMaster7 Ай бұрын
Thank you so much! I started learning asp.net and created a simple chess app with some crud functionalities besides the game. I started learning about clean architecture, DDD, repository pattern, unit of work patterns, aggregates, CQRS and was overwhelmed for months. While in reality I only needed simple transaction scripts for the CRUD and sockets for the game
@CodeOpinion
@CodeOpinion Ай бұрын
Yup. Different problems need different solutions.
@malismo
@malismo Жыл бұрын
I think the biggest problem lies in terminology, it would have been better named Business Driven Design. You have to talk with and listen to business people and find out together, as you briefly mentioned, what processes drive the business and model those properly using the best DSL for each. IT is too stuck on patterns and best practices for its own good. It is called computer science, but I often experience it as computer religion. In my opinion, it should keep itself as far away from dogmatic practices as possible and has failed miserably at that the past decade. Sample code bases and preaching patterns are some of the root causes of that failure. Great videos, keep it up, you have a great way to explain difficult stuff in an easy to understand way, rare skill in our Industry.
@aslkdjfzxcv9779
@aslkdjfzxcv9779 Жыл бұрын
love your topics. AND i appreciate the simple thumbnails.
@havokgames8297
@havokgames8297 Жыл бұрын
Really good video. I totally agree. Now I would love to see someone attempt to teach the transition from transaction script to domain objects. I imagine it would take the length of a course instead of a single video to show, but finding the pieces that are shared between transaction scripts and making decisions about how to extract them into rich objects would be fantastic.
@CodeOpinion
@CodeOpinion Жыл бұрын
I've done something similar before but probably worth another video. Thanks for the suggestion
@robertmrobo8954
@robertmrobo8954 Жыл бұрын
@@CodeOpinion Would be really happy if you choose any different system than Products, Orders or Warehouse. A totally different domain.
@MrDomenic123
@MrDomenic123 Жыл бұрын
07:33 When you think your microphone has an issue and you replay that part two times, just so you can realize that Derek was farting on you 🤣🤣🤣
@CodeOpinion
@CodeOpinion Жыл бұрын
Figured it was a nice touch to add a fart.
@juanprosales
@juanprosales Жыл бұрын
@CodeOpinion I like that you highlight that the key is to put the focus on understanding the domain before coding, but you also said that is not possible to explain concepts with a complex sample. I would love to see how would you explain DDD concepts, and not just saying when not to do it (just bc I saw you criticize the work of others a few times 😉)
@CodeOpinion
@CodeOpinion Жыл бұрын
Thanks for the comment. How would I explain DDD concepts? Well not in a 10 minute video 😂. But in aggregate you probably can get the gist from a pile of videos I've published. The tactical patterns are a means to an end and aren't required at all. For example, in a functional lang you aren't creating object models as domain models. If I were spending time explaining it, in length, it would be more in depth to each parts of the last diagram I showed and how the iterations are important.
@juanprosales
@juanprosales Жыл бұрын
​@@CodeOpinion and after I commented I saw this video of yours which I think it's really great (kzbin.info/www/bejne/hqOteoCKj9iVetk) that you published before becoming a reference-app killer 😋. Just kiding, only wanted to say that ref apps are not bad if we are aware they are over simplified demostrations of how to estructure the code, that we can apply it when we have a complex domain.
@z0nx
@z0nx Жыл бұрын
Derek, one of the things I believe many are struggling with, is getting a mental model of what application/domain/team is responsible for what event, and how these should interact. One way to get to that point is to collaborate, visualize and discuss. That's actually one of the things that tends to draw me to Event Modeling, are you familiar with this? Is there any other tooling that is your go-to for this kind of thing? I'm not yet familiar with EventStorming, but I keep hearing about it, so maybe it's better? The few times I've been able to do such an eventmodeling session, lots of input and discussion seem to come naturally to people, I really like that aspect.
@CodeOpinion
@CodeOpinion Жыл бұрын
I am familiar with Event Modeling. Event Storming is similar but different. Event Storming is more for collaborating for discovery, exploring the domain. Event Modeling is more about output for building the system.
@dlcardozo
@dlcardozo Жыл бұрын
The code should be an asset at the end of the understanding of the problem to solve. When you start from the code you missed all about DDD. And TRY HARD to have a common language between all the people involved in solving that problem, that language should be on each line of code. The code will change, be ready for that, because the domain model (the problem) will change iteration after iteration.
@yakovkemer5062
@yakovkemer5062 Жыл бұрын
I think model is overcomplicated. It should be done either with validator, or validation attributes.
@thedacian123
@thedacian123 Жыл бұрын
Ok,so in order to have a good grasp about a domain we are addicted on business expoert,Are not we?,we can do without their help. And seconddly ,for the verry begining when we don't have any deep knowledges about the doain ,is it ok to start with the simplest Transaction script?!thank you!
@kirillhorn3186
@kirillhorn3186 Жыл бұрын
Almost in every video you mention transaction script, could someone explain me what it actually is. I was doing DDD, I was thinking so, but in most cases it's just a wrapper above setter.
@m4r10x2
@m4r10x2 Жыл бұрын
An example of the transaction script is when you inject DbContext, do some business stuff in the method, in the same method you update DB and at the end you call _db.SaveChanges(). There is no domain objects, you usually work with your DB entities directly, update the state, and save them into the DB.
@kirillhorn3186
@kirillhorn3186 Жыл бұрын
@@m4r10x2 thanks a lot!
@matheussantiago203
@matheussantiago203 Жыл бұрын
Hi! I really like your videos and I would love it if you could recommend me other channels that teach software design/architecture
@marcusmaunula5018
@marcusmaunula5018 Жыл бұрын
But what open source projects that are not samples as good study points? Do you have any such examples :)
@CodeOpinion
@CodeOpinion Жыл бұрын
That's the problem. There aren't any that I'm aware of.
@marcusmaunula5018
@marcusmaunula5018 Жыл бұрын
@@CodeOpinion Worth a shot ;).
@GackFinder
@GackFinder Жыл бұрын
I would bet all really good examples are highly protected corporate secrets because they probably generate a lot of money. No way anything truly good would be just freely available. Good stuff costs money.
@piromanaBG
@piromanaBG Жыл бұрын
Completely agree
@Mike-rt2vp
@Mike-rt2vp Жыл бұрын
"... You should start caring." Right into ad read, lol. No disrespect just thought it was funny.
@marna_li
@marna_li Жыл бұрын
Reference projects are built by technical people who care about the implementation details before the process of understanding what they are building. I think we are all guilty of doing this at some point. I have tried to make a reference project that shows the details, but you always end up with some simple scenario that doesn't illustrate more than the concepts in code. Concepts that are hard to grasp without the context. And they are misleading people who are looking for samples on how to implement code "DDD"-style. Not even telling them about the tradeoffs that they have to make. Not every developer is as passionate about programming and learning new things. Seeing everything from a technical lens is not gonna sell if you are in a team. There are people who just want to do their jobs.
@CodeOpinion
@CodeOpinion Жыл бұрын
Yup. Why I included "in a vacuum" they are a net negative because as you mentioned they don't illustrate trade-offs or often the "why" something is being done because the examples are so trivial. They have to be trivial to get the gist across because nobody wants to spend days to grok some all the domain complexity.
@CesarDemi81
@CesarDemi81 Жыл бұрын
I think they are mostly to get you a structure to get started with, but not a full prescription on how things need to be done. My opinion is that it's more about getting the boilerplate part done with something that might more closely ressemble what you're trying to achieve rather than them being a fully closed prescription on how things need to be done.
@AkosLukacs42
@AkosLukacs42 Жыл бұрын
Yepp, DDD is not a coding pattern!
@manrikevillalobos6270
@manrikevillalobos6270 Жыл бұрын
Finally someone said it!! Completely agree, and that is one of the main reasons of bad DDD coding examples out there, and DDD being really misunderstood... and abused. DDD is not a coding pattern, neither an architecture!! It's a guide to model a business... my God!!
@feitan8745
@feitan8745 Жыл бұрын
Most of the samples are not helping at all, because when we really to use these, it's in a much bigger scale and in a more complex scenario.
@awright18
@awright18 Жыл бұрын
This may be the best title for a video that you've ever created!
@CodeOpinion
@CodeOpinion Жыл бұрын
😂 I agree
@danielgilleland8611
@danielgilleland8611 Жыл бұрын
S.A.M.P.L.E - Simple And Mediocre Problem Learning Exercise ;)
Domain Modeling Gone Wrong - Part 1
8:21
CodeOpinion
Рет қаралды 27 М.
Why is Clean Architecture so Popular?
11:52
CodeOpinion
Рет қаралды 49 М.
Миллионер | 1 - серия
34:31
Million Show
Рет қаралды 2,8 МЛН
Good teacher wows kids with practical examples #shorts
00:32
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН
ТИПИЧНОЕ ПОВЕДЕНИЕ МАМЫ
00:21
SIDELNIKOVVV
Рет қаралды 1,4 МЛН
Domain-Driven Design Made Me Realize Something About AI Tools
14:39
Владимир Хориков - Domain-driven design: Cамое важное
1:13:59
DotNext — конференция для .NET‑разработчиков
Рет қаралды 54 М.
Focusing on "Entities" leads nowhere good.
9:41
CodeOpinion
Рет қаралды 23 М.
Is an Anemic Domain Model an Anti-Pattern?
9:54
Milan Jovanović
Рет қаралды 22 М.
HELP! My system is hard to change
10:52
CodeOpinion
Рет қаралды 10 М.
Миллионер | 1 - серия
34:31
Million Show
Рет қаралды 2,8 МЛН