Modeling a Domain With Domain-Driven Design From Scratch | DDD

  Рет қаралды 78,571

Milan Jovanović

Milan Jovanović

Күн бұрын

Get the source code for this video for FREE → the-dotnet-weekly.ck.page/dom...
☄️ Master the Modular Monolith Architecture: bit.ly/3SXlzSt
📌 Accelerate your Clean Architecture skills: bit.ly/3PupkOJ
🚀 Support me on Patreon to access the source code: / milanjovanovic
Domain-Driven Design is a set of principles for how you can design and model a rich domain in your application. In this video, I'll start with a diagram of a domain model and then I'm going to apply some Domain-Driven Design patterns to create the domain models.
Join my weekly .NET newsletter:
www.milanjovanovic.tech
Read my Blog here:
www.milanjovanovic.tech/blog
Subscribe for more:
/ @milanjovanovictech
Chapters
0:00 Domain model diagram
0:58 Organizing around features
1:59 Creating the Customer Entity
4:23 Adding the Product Entity
5:19 Modeling Money as a Value Object
7:00 Sku as Value Object with Static Factory
10:36 Creating the Order aggregate
11:34 How should we model the LineItem?
13:33 Adding LineItems to Order
16:19 Static Factory for creating an Order
17:15 Common patterns in DDD

Пікірлер: 164
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Get the source code for this video for FREE → the-dotnet-weekly.ck.page/domain-modeling
@johnrollan2256
@johnrollan2256 10 ай бұрын
@MilanJovanovicTech i cant understand, can u please explain in plain english how u can - what exactly means 'Domain'? if possible with example. Thank you.
@aarondebrabant8783
@aarondebrabant8783 Жыл бұрын
Love the approach of doing these from scratch, I'd like to see more of this!
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Thanks, I'll try to balance this out in the future and include more "from scratch" videos
@techpc5453
@techpc5453 Жыл бұрын
we support you continue >>>>>
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I need the support. Thank you!
@justtomi-qp8qj
@justtomi-qp8qj Жыл бұрын
Such a smooth introduction into some of the tactical DDD concepts :) Love usage of the records part and the fact that you started fresh with a simple domain model! Stay awesome Milan!
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I was against records for a while, but now I realize they're perfectly fine
@daedwill
@daedwill Жыл бұрын
Thanks Milan, can't get enough of your videos.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
What a compliment 😁
@nove1398
@nove1398 Жыл бұрын
Great explanation and the fact that you start from scratch is very helpful!
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Looks like people enjoy "from scratch" videos. I'm tempted to make more of these
@zokocx
@zokocx Жыл бұрын
Great video. And really like that you point what is difference between Entity and AggregateRoot.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Thank you, I'm glad it was clear :)
@bmassioui
@bmassioui Жыл бұрын
Thank @millan for this awesome exercise.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Glad you liked it!
@stephendgreen1502
@stephendgreen1502 Жыл бұрын
Very good. Very clear. Thank you.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I prepared a few more on DDD, and we'll see where I take it from there 😁
@HelloWorld-th9vb
@HelloWorld-th9vb Жыл бұрын
Liked, waiting for the next one😊
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
More to come!
@nayanchoudhary4353
@nayanchoudhary4353 Жыл бұрын
Nice! Waiting for next
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Will upload soon
@mahmoudalaskalany
@mahmoudalaskalany Жыл бұрын
very clear thank you for the continuous contribution
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
You are very welcome. I prepared a few more in the coming days :)
@mahmoudalaskalany
@mahmoudalaskalany Жыл бұрын
@@MilanJovanovicTech looking forward to it am building my own DDD architecture following your tips
@MahmoudIsmail-rw7hg
@MahmoudIsmail-rw7hg 10 ай бұрын
Thank you Milan, l like your explanation
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
You are welcome!
@mozamilahmadafghan4889
@mozamilahmadafghan4889 Жыл бұрын
Very clearly explained
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Thanks!
@culpritdesign
@culpritdesign Жыл бұрын
I do Business Intelligence dimensional modeling and it's cool how similar it is to the domain-driven design you are teaching here. When we have shared objects across domains when we call those "conformed dimensions". We put them in a "shared" folder as you mentioned, but then we produce references to them in each domain so that, as for as the domain is concerned, it exists within its folder. Of course, I am comparing apples to oranges since these are just datamarts and not applications but it's cool to see similar concepts. I could almost envision myself using something similar to this for building a data warehouse in C#, but the output would probably need to be columnar parquet files and I'm not sure I understand how you would do large updates across records in this design. I subscribed and will definitely watch more.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Huh, now you've inspired me to learn more about BIDM (I made up this acronym) 😁
@PatricSjoeoe
@PatricSjoeoe Жыл бұрын
Great video as always :)
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Thank you! Cheers!
@artemvolsh387
@artemvolsh387 Жыл бұрын
Another great video, thanks a lot!)
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Glad you liked it!
@lasindadilshan7860
@lasindadilshan7860 Жыл бұрын
Great from scratch to advance 😍
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I think we need more videos like that. Do you agree?
@taner-saydam
@taner-saydam Жыл бұрын
@@MilanJovanovicTech Definitely🙏
@lasindadilshan7860
@lasindadilshan7860 Жыл бұрын
@@MilanJovanovicTech yes ❤️
@Dragonet17
@Dragonet17 Жыл бұрын
Great topic !
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Thank you!
@ArturoNull
@ArturoNull Жыл бұрын
Thank you!!
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
You're welcome!
@amustafa
@amustafa 4 ай бұрын
Thanks, from my heart!
@MilanJovanovicTech
@MilanJovanovicTech 4 ай бұрын
You're welcome!
@taner-saydam
@taner-saydam Жыл бұрын
Great, thanks 🤩🤩
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
You’re welcome 😊
@xmdbr
@xmdbr Жыл бұрын
Great video as always. Are you planning to create a series or course like creating an application from scratch, adding more functionality, and showing the best practices? Something like the first DDD series, but recorded from 0, without code written with the camera off. Feel free to interpret this as a suggestion :D. Love from Poland
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Yes, something like that. I'll try to either not write code off-screen, or use existing libraries
@vitovondervollbart1620
@vitovondervollbart1620 Жыл бұрын
Great DDD video Milan! Will you soon pierce the veil of persistence ignorance and do a video on how to map this domain model to an ORM like EF Core? I’m very interested in how you treat the Value Object side of things. 🙌
@vitovondervollbart1620
@vitovondervollbart1620 Жыл бұрын
Owow! I should have looked deeper before posting! Tysm! 🎉kzbin.info/www/bejne/f527n3yba9WSi80
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I see you found the answer 😁
@robertocruzfalcon1622
@robertocruzfalcon1622 Жыл бұрын
Great video as always, thanks! What program do you use to create the diagram? Looks great.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Excalidraw :)
@fishmobb3009
@fishmobb3009 Жыл бұрын
Thanks!
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Wow, thank you very much Daniel! 😊 I don't often get 'super thanks' so I'll remember this one for a while. Anything I can do for you to be helpful? Maybe you have a video suggestion?
@fishmobb3009
@fishmobb3009 Жыл бұрын
I just want to say thanks. I like your videos and the level of details 😊.
@adamjankowski5755
@adamjankowski5755 Жыл бұрын
Hello Milan I love your videos. DDD ones are my favorite. I would love to see a video where you explain how to decide which entities should be aggregate roots and which Entities they control. I will conjure up an example based on this video. We have Customer | Order | LineItem We could split it into 2 aggregate roots first beeing Customer alone The second one would be Order and it would control LineItem which means that you could only create it using methods exposed in Customer Why not set only Customer class as an aggregate root? It would control Order and LineItem. Or maybe it would control Order and Order would control LineItem? What are the rules of deciding the boundries between aggregate roots? Should we keep aggregates as small as possible?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Ask this question: Can the Order exist without the customer? The Customer has to create the Order, yes. But someone else can also create the Order on behalf of the Customer. And even if we delete the Customer from our system, the Order should remain as a historical fact.
@bogdanb904
@bogdanb904 Жыл бұрын
The records are not completely safe with the private constructor, because of the copy constructor they have, allowing the 'with' syntax. So you can create an invalid SKU for example, from a valid one.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Ah, but does that change *the existing* record instance, or creates a new one? 😁 Agreed, you can bypass it using the *with* expression, but do you even want to bother with that _hack_?
@bogdanb904
@bogdanb904 Жыл бұрын
@@MilanJovanovicTech It creates a new instance. Just pointing out that records have some caveats. It would be strange for a developer hacking his own code
@adiviuh3693
@adiviuh3693 Жыл бұрын
Great job. I hope you will continue these videos. Have you ever planed to show us a bad part of DDD? I mean a communication with database. How to configure entities for db and how to handle situations, when the amount of data grows and your entities contain collections of other entities. Is lazy loading a good or a bad practice?
@adiviuh3693
@adiviuh3693 Жыл бұрын
You have a great understandable accent. Where are you from?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Serbia :)
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
And yes, I actually have a few video recorded - Strongly Typed IDs - Anemic Domain Model - EF + DDD Mapping Looks like I hit the right topics? 😁
@adiviuh3693
@adiviuh3693 Жыл бұрын
@@MilanJovanovicTech Yeah, Right. We are waiting new series.
@marvinxulu7816
@marvinxulu7816 Жыл бұрын
Hi Milan, Question, why did you add a concrtuctor in the order page ? Or constructors are mandatory in all the classes you create
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I usually add the constructors directlt
@artsenvi
@artsenvi Жыл бұрын
Great video ! ...but I have a quick question. Money becomes a shared concept and you stated it might be good to create a shared folder, then you used the Customer in your Order without any need to move it in a shared folder or to create a Customer in your Order folder. Why ? And what would be your contexts boundaries ? I felt like each "folder" could be considered a context and needed to be independant. Might be in a newer video that I missed, so feel free to push me in this direction. :D
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
We're still inside a single domain, so it's a bit difficult to see everything. I think it'll make more sense when I move into a Modular Monolith architecture.
@radhoinemejai1879
@radhoinemejai1879 Жыл бұрын
I have two question which is the best practise : 1- have the IRepository in the domain or the application layer? 2- When validation we have to return a questom Result type instead of thrown the error, so we need to put the custom response to the domain layer also? thank you so much for you videos and your help
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
1) You need to decide what approach you're taking, I did a video about it a week or two ago 2) Or you can use some sort of generic Result type
@lionelsalabartan9210
@lionelsalabartan9210 Жыл бұрын
Thanks for the content. I have a question about the utility of OrderId in LineItem. I understand very well for the database schema (infrastructure) that this field is needed to retrieve the lines, but in the domain if Order is an aggregate and LineItem is managed by Order and don't need OrderId. I have seen another content about this subject where the author removes the aggregate id from the entity which is incorporated in the aggregate, that why I wonder that.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Agreed, from a pure Domain model perspective it's not required. But I do add it since I like to be practical, and also solve some persistence concerns ahead of time.
@lionelsalabartan9210
@lionelsalabartan9210 Жыл бұрын
@@MilanJovanovicTech I see. Thank you for your answer.
@cyberkoka
@cyberkoka Жыл бұрын
Nice intro to ddd modeling, just add strongly typed ids to avoid primitive obsession and that's all :)
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Did you just guess what the next video is about? 👀
@viktorandrusenko6467
@viktorandrusenko6467 5 ай бұрын
Hi, Milan. I'm trying to repeat your project with my own additions and wanted to clarify some points: 1. Why did you change the LineItems type from HashSet to List in one of the videos, if you wanted unique values in it. 2. How many Orders can one user have? Does the Order entity serve as a kind of product cart? 3. Does AutoMapper conflict with DDD principles?
@MilanJovanovicTech
@MilanJovanovicTech 5 ай бұрын
1 - No particular reason 2 - Many orders. It's the purchase/sale 3 - Not necessarily, but I don't use mapping libraries
@MohamedAliSoltani93
@MohamedAliSoltani93 9 ай бұрын
Hello @Milan Thanks for the video: I like it! I have two questions (basic questions), if I can: 1/ Why did you choose to create a record Money instead of a class? 2/ Why did you choose to make Create method inside Order class as static instead of non-static?
@MilanJovanovicTech
@MilanJovanovicTech 9 ай бұрын
1) With a record I get structural equality, which is a quality I want for my value objects 2) What would call the Create method if it wasn't static? I'd need an order instance - but then what's the point of having a Create method.
@MohamedAliSoltani93
@MohamedAliSoltani93 9 ай бұрын
@@MilanJovanovicTech sorry for the second question: it seems two stupid 😅
@michelchaghoury9629
@michelchaghoury9629 5 ай бұрын
nice vid, one question, we introduced validation in our domain, if the rules of creating valid domains becomes bigger and bigger, where should we put them, and how to utilize them in the domain (constructor, using it staticly, etc) ?
@MilanJovanovicTech
@MilanJovanovicTech 5 ай бұрын
Do you make a distinction between domain rules and application/data-integrity rules?
@michelchaghoury9629
@michelchaghoury9629 5 ай бұрын
yes but i mean simple null checking is ok in the domain record/class (correct me if i am wrong), but if i have a big and complex validation it should be in the application project, but i want to make sure that the record/class instance object is not created unless it is considered valid, so in this case what should we do?@@MilanJovanovicTech
@helloworld9018
@helloworld9018 Ай бұрын
Hey! What if I define ProductId not just like GUID but as you've done it in some other videos where you've created separate file ProductId with a record (Guid Value). Now I can't just reference this type in LineItem because it comes from another aggregate (Product). What is a workaround here? Is it to create very same ProductId record in Order folder?
@MilanJovanovicTech
@MilanJovanovicTech Ай бұрын
The ID is still something you can reference, regardless
@winstochurgle9133
@winstochurgle9133 5 ай бұрын
Hi Milan. Do you always have to make a Static Factory Method just to get set entity's properties? Or constructor, whatever. And you didn't do that for Customer entity. Why?
@MilanJovanovicTech
@MilanJovanovicTech 5 ай бұрын
No, not always. Static factory is useful when I want to trigger some side effects after creating the entity.
@vertikalniserklaz8694
@vertikalniserklaz8694 2 ай бұрын
At 0:40 you are describing the domain model, what exactly you are referring to? Are you pointing to entities, aggregate roots, and value objects or there is something else that belongs to the domain model?
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
With Domain model I mean the conceptual representation of problem domain in the diagram. Entities/Aggregates/Value objects are just tactical patterns to represent the Domain model in the code and enforce the invariants.
@vertikalniserklaz8694
@vertikalniserklaz8694 2 ай бұрын
@@MilanJovanovicTech in a few words - are Domain Services part of Domain Model?
@melfahnestock993
@melfahnestock993 Жыл бұрын
I'm wondering if LineItem should be an entity? I don't think it needs an Id when it can use OrderId and productId to identify it. It does need its own table, so does that mean it's entity by default?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
What happens when there are many line items? So that there are performance issues when loading all of them into memory. If you make it into an entity, you can solve that problem by just loading that one entity.
@ravimungalpara9595
@ravimungalpara9595 8 ай бұрын
Since static methods are not thread safe, is it a good idea to use it while creating objects.
@MilanJovanovicTech
@MilanJovanovicTech 8 ай бұрын
Why would I care about that in the context of creating a Domain entity?
@ravimungalpara9595
@ravimungalpara9595 8 ай бұрын
@MilanJovanovicTech I was just thinking from high-performance application pov where many orders are getting created simultaneously and while creating order object via factory if we pass customer info, is it possible that other customer info gets populated rather actual customer info.
@TheAzerue
@TheAzerue Жыл бұрын
Hi One question. How does it goes with EF core. I mean if we have associations with different class. EF core will treat them as separate tables, which could go wrong for example Price record. Please share insights regarding this. thanks
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Make it an owned entity
@vinayakkolhe5909
@vinayakkolhe5909 6 ай бұрын
Great explanation and Great video. I have tried it. It works also have tables with correct data but .... When I read from table _context.Orders.Include("ListItems").ToList(); It fails to load. If I use it without include then it works but don't have ListItems data _context.Order.ToList();
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
What's the error?
@pmaculan
@pmaculan Жыл бұрын
It is not clear to me why not use a direct reference to Product and Customer objects inside Order instead of using their Ids.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Aggregates are not allowed to hold other aggregates. You can only reference them by ID.
@ilyazakharov5050
@ilyazakharov5050 Жыл бұрын
@@MilanJovanovicTech could you please explain that? What would happen if we have a Product type property instead of Guid?
@user-kj4gw3rj5y
@user-kj4gw3rj5y 7 ай бұрын
Why do we use the Create method? Why don't we use a constructor for this? After all, you can define all the checks during creation in the public constructor. What is the point of Create?
@MilanJovanovicTech
@MilanJovanovicTech 7 ай бұрын
I don't like side-effects in constructor (raising domain events)
@Roshan-tb3iz
@Roshan-tb3iz 7 ай бұрын
In this example, would modifying the price of a Product entity be restricted to an Order aggregate? How would you update a Product that did not belong to an Order?
@MilanJovanovicTech
@MilanJovanovicTech 7 ай бұрын
The Product is completely unrelated to an Order. Unless you mean updating the price on a LineItem?
@harshaghanta1
@harshaghanta1 11 ай бұрын
With all of that code added ? Does Sku still need to be a record type ?
@MilanJovanovicTech
@MilanJovanovicTech 11 ай бұрын
Does it?
@ramytawfik9168
@ramytawfik9168 Жыл бұрын
one more thing please I cannot understand actually what is the difference when we create a recordcalled Money that has two props : Curreny and amount And of simply adding two Columns inside the table called : Currency and Amount ?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Read about the Value object concept
@ramytawfik9168
@ramytawfik9168 Жыл бұрын
How we will access the Add method inside Order Model since its constructor is private ?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Order.Create is public, Add method is also public
@ramytawfik9168
@ramytawfik9168 Жыл бұрын
@@MilanJovanovicTech it is public but not static
@Andy01010
@Andy01010 Жыл бұрын
The only issue with records is that EF does not support it directly, so I don’t think you will be able to map these sort of value objects on the fly
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
What do you mean? Records work with EF. I'll show it on Tuesday.
@Andy01010
@Andy01010 Жыл бұрын
@@MilanJovanovicTech Check out Khorikov’s article about the suitability of records as value objects. He puts forward a decent argument. I came across it a while back, which was enough for me to be deterred from using them with EF core, at least for the time being. Also, value objects aside, Microsoft documentation says that EF doesn't support updating with immutable entity types, which is not a total show stopper of course but does make few alarm bells ringing when you consider using them with EF in general. If you found a nice and neat way of incorporating them as value objects - I’m really looking forward to your video on Tuesday 👍
@vovcheable
@vovcheable Жыл бұрын
We can make ProductId a value object too, and pass it to Add() method instead of whole Order object. upd: oh, sorry, you already make video about strongly typed Id after this video :)
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Yup, but I'm glad you made a connection between the two videos 😁
@shalram02
@shalram02 Ай бұрын
I am just curious. Why we were using GUID over all instead of Int as type? Is this GUID are sequenced?
@MilanJovanovicTech
@MilanJovanovicTech Ай бұрын
To be able to provide the Id on the client side, among other things.
@shalram02
@shalram02 Ай бұрын
​​@@MilanJovanovicTechI really appreciate your quick response.... I see GUID are not sequenced does it benefit us really If our Database is not distributed.
@mrwalkan
@mrwalkan 11 ай бұрын
How do you map those in databases using EF?
@MilanJovanovicTech
@MilanJovanovicTech 11 ай бұрын
Check out the next video
@elpe21
@elpe21 Жыл бұрын
I'm on the model screen and I would like to see it expanded to customer has price list and product has different price per price list :) (sorry if something is later in the video about it :D )
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I hope I didn't disappoint too much
@elpe21
@elpe21 Жыл бұрын
@@MilanJovanovicTech you did not. However the concept I've mentioned in one hand seems to be fairly simple on the other hand it brings a lot of complexity. For example, customer can be moved from one price list to another between orders
@pawel131657
@pawel131657 20 күн бұрын
Even better if id's were strongly typed like: public record ProductId(Guid Value); Don't do that and you receive a contraption like this LineItem constructor that is asking for troubles. I'm just assuming it's for the sake of keeping the video reasonably short. Wouldn't hurt to at least mention that pattern, though. Other than that great tutorial, thanks!
@MilanJovanovicTech
@MilanJovanovicTech 20 күн бұрын
I did cover it here: kzbin.info/www/bejne/gpXVfpd_lsd4Z9E
@DENDYTWOO
@DENDYTWOO Жыл бұрын
Can someone explain to me what does "Aggregate" mean?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
This is from Martin Fowler: martinfowler.com/bliki/DDD_Aggregate.html
@_NguyenHaoTien
@_NguyenHaoTien Жыл бұрын
Excuse me, I'm a newbie, when you create a function Create in Order Model, is there SRP rule scope in SOLID?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I consider all of it to be the SINGLE responsibility of the Order aggregate, therefore it's fine to have it in the class
@angelldark6426
@angelldark6426 10 ай бұрын
We do not use the interface?
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Which one?
@angelldark6426
@angelldark6426 10 ай бұрын
@@MilanJovanovicTech I thought that when creating Customer we should create ICustomers and describe the logic inside it. ? But I'm not sure about that
@RyptHunterz
@RyptHunterz Жыл бұрын
Hi ! DDD does not respect SOLID principles ? Am I wrong?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
How does it not respect SOLID?
@aj.arunkumar
@aj.arunkumar Ай бұрын
are you against strongly typed ids?
@MilanJovanovicTech
@MilanJovanovicTech Ай бұрын
Not necessarily
@simonhamelech
@simonhamelech 11 ай бұрын
Why did you make the _lineItems list readonly?
@MilanJovanovicTech
@MilanJovanovicTech 11 ай бұрын
So that it's readonly 😅
@simonhamelech
@simonhamelech 11 ай бұрын
But you have an Add method that adds a new LineItem to this readonly immutable list after it has been constructed
@vitahvitah5823
@vitahvitah5823 Жыл бұрын
I would like to have a code...
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
I share it on Patreon
@ThugLifeModafocah
@ThugLifeModafocah Жыл бұрын
email should also be a value object.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Agreed, but didn't want to steer off in that direction
@TheDuerden
@TheDuerden 10 ай бұрын
To be fair - you do cover that here: kzbin.info/www/bejne/nJaXmqiXpN16mKM - I just had to find you doing it somewhere!!
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
It's a bit difficult going over everything in depth on a single video
@TheDuerden
@TheDuerden 10 ай бұрын
You say from scratch - then jump straight into a project with a domain set up with no explanation of how you got there....for those of us not familiar with VS that first step would have been nice to see.
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Sorry 🤷‍♂️😅
@diesunddasDE
@diesunddasDE 7 ай бұрын
That has nothing to do with DDD, as it is the designing process, not the implementation. For an introduction way too deep into technology
@MilanJovanovicTech
@MilanJovanovicTech 7 ай бұрын
I focus more on the technology aspects, in general
@diesunddasDE
@diesunddasDE 7 ай бұрын
@@MilanJovanovicTech Well, I find it confusing for a beginner to understand the idea behind DDD if you go straight and show source code. In reality, DDD is very unspecific, abstract and behind source code. Especially, when talking about Bounded Contexts, Context Mapping (OHS, ACL etc.) which is actually a graphical process, shown by unified diagrams, which both, stakeholders and developers, can understand.
@catfishfortesque-smythe437
@catfishfortesque-smythe437 9 ай бұрын
THOSE. WORD. CAPTIONS. AT. THE. BEGINNING. ARE. SO. ANNOYING.
@MilanJovanovicTech
@MilanJovanovicTech 9 ай бұрын
Thanks
@lourenceplay9017
@lourenceplay9017 2 ай бұрын
Hey Milan. What is the most effective way to change dependent class fields from other classes in the DDD approach?Just create methods inside the class to add/update/delete for each field? Do I really have to write a cqrs commands for every change to this entity? Let's say, in addition to the usual fields in class "A", there are the following related to other classes that i want to change: public IReadOnlyList? Cuisines => _cuisines?.ToList(); private readonly List _cuisines = new(); public IReadOnlyList? Reviews => _reviews?.ToList(); private readonly List _reviews = new(); public IReadOnlyList? Features => _features?.ToList(); private readonly List _features = new(); public IReadOnlyList? WorkSchedules => _workSchedules?.ToList(); private readonly List _workSchedules = new();
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
I don't think 😂
@lourenceplay9017
@lourenceplay9017 2 ай бұрын
@@MilanJovanovicTech Yeah...any suggestions then?🙄 I mean, In my subject area, there is a Catering class that depends on the tables of Features, Cuisines, Reviews and Work Schedules, as written above. Splitting the Catering class into smaller ones does not seem optimal to me.
@somyarathee
@somyarathee 4 ай бұрын
thanska. lot
@MilanJovanovicTech
@MilanJovanovicTech 4 ай бұрын
Sure thing!
How Strongly Typed IDs Can Make Your Code More Expressive | DDD
12:02
Milan Jovanović
Рет қаралды 30 М.
How I installed the HARDEST operating system
34:40
Bog
Рет қаралды 3,9 М.
Whyyyy? 😭 #shorts by Leisi Crazy
00:16
Leisi Crazy
Рет қаралды 19 МЛН
Купили айфон для собачки #shorts #iribaby
00:31
Creating .Net Core Microservices using Clean Architecture
26:02
Rahul Sahay
Рет қаралды 16 М.
How To Use Domain-Driven Design In Clean Architecture
30:27
Milan Jovanović
Рет қаралды 101 М.
Is an Anemic Domain Model an Anti-Pattern?
9:54
Milan Jovanović
Рет қаралды 19 М.
Непробиваемый телевизор 🤯
0:23
FATA MORGANA
Рет қаралды 407 М.
iPhone 15 Unboxing Paper diy
0:57
Cute Fay
Рет қаралды 3,9 МЛН
ПОКУПКА ТЕЛЕФОНА С АВИТО?🤭
1:00
Корнеич
Рет қаралды 1,5 МЛН
iPhone 15 Pro vs Samsung s24🤣 #shorts
0:10
Tech Tonics
Рет қаралды 13 МЛН
How charged your battery?
0:14
V.A. show / Магика
Рет қаралды 5 МЛН