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

Поделиться
HTML-код
  • Опубликовано: 22 ноя 2024

Комментарии • 55

  • @Greenthum6
    @Greenthum6 Год назад +14

    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 Год назад +6

      In defense... If implemented correctly, it would propably scale to the moon 😂

    • @CodeOpinion
      @CodeOpinion  Год назад

      Exactly.

    • @Greenthum6
      @Greenthum6 Год назад +1

      @@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 2 месяца назад

      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 Год назад +2

    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 7 месяцев назад +1

      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.

  • @justgame5508
    @justgame5508 Год назад +8

    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

  • @brandonpearman9218
    @brandonpearman9218 Год назад +19

    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  Год назад +9

      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.

  • @nove1398
    @nove1398 Год назад +2

    I like this explanation about the samples being too simplistic to properly demonstrate the concept that needs to be learned.

  • @JeffryGonzalezHt
    @JeffryGonzalezHt Год назад +2

    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.

  • @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.

  • @majormartintibor
    @majormartintibor Год назад +2

    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  Год назад +1

      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.

  • @ChickenMaster7
    @ChickenMaster7 3 месяца назад

    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  3 месяца назад

      Yup. Different problems need different solutions.

  • @malismo
    @malismo Год назад +1

    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  Год назад +1

      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.

  • @CrapE_DM
    @CrapE_DM Месяц назад

    Yeah, I've hated how much people demonstrate DDD and Event Sourcing with basic CRUD setters

  • @MrDomenic123
    @MrDomenic123 Год назад +2

    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  Год назад +6

      Figured it was a nice touch to add a fart.

  • @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!

  • @z0nx
    @z0nx Год назад +1

    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  Год назад +1

      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.

  • @juanprosales
    @juanprosales Год назад +1

    @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  Год назад +1

      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 (ruclips.net/video/PrJIMTZsbDw/видео.html) 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.

  • @kirillhorn3186
    @kirillhorn3186 Год назад +2

    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 Год назад +2

      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!

  • @dlcardozo
    @dlcardozo Год назад +1

    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 Год назад +1

    I think model is overcomplicated. It should be done either with validator, or validation attributes.

  • @marcusmaunula5018
    @marcusmaunula5018 Год назад

    But what open source projects that are not samples as good study points? Do you have any such examples :)

    • @CodeOpinion
      @CodeOpinion  Год назад +1

      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.

  • @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

  • @piromanaBG
    @piromanaBG Год назад

    Completely agree

  • @Mike-rt2vp
    @Mike-rt2vp Год назад

    "... You should start caring." Right into ad read, lol. No disrespect just thought it was funny.

  • @AkosLukacs42
    @AkosLukacs42 Год назад +1

    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!!

  • @marna_li
    @marna_li Год назад +2

    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.

  • @awright18
    @awright18 Год назад +1

    This may be the best title for a video that you've ever created!

  • @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.

  • @danielgilleland8611
    @danielgilleland8611 Год назад

    S.A.M.P.L.E - Simple And Mediocre Problem Learning Exercise
    ;)