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

  Рет қаралды 92,497

Milan Jovanović

Milan Jovanović

Күн бұрын

Пікірлер: 180
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Get the source code for this video for FREE → the-dotnet-weekly.ck.page/domain-modeling Want to master Clean Architecture? Go here: bit.ly/3PupkOJ Want to unlock Modular Monoliths? Go here: bit.ly/3SXlzSt
@johnrollan2256
@johnrollan2256 Жыл бұрын
@MilanJovanovicTech i cant understand, can u please explain in plain english how u can - what exactly means 'Domain'? if possible with example. Thank you.
@CowboyCoder21
@CowboyCoder21 Жыл бұрын
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 😁
@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) 😁
@GC-qe8vc
@GC-qe8vc 4 ай бұрын
Creating a folder per entity is not organising the model around features, it's organising it around entities. Features are about functionality, i.e. behaviour. You started from what is essentially a normalized database schema and created a 1 to 1 correspondance with classes representing entities. Use cases, functionality, behaviours were presented as an afterthought
@MilanJovanovicTech
@MilanJovanovicTech 4 ай бұрын
I sometimes use feature folder/aggregate folder interchangeably. The main idea being to promote this type of folder structure as opposed to a technical one such as Entities/[all the domain classes inside]
@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
@bmassioui
@bmassioui Жыл бұрын
Thank @millan for this awesome exercise.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Glad you liked it!
@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 :)
@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
@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
@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
@viktorandrusenko6467
@viktorandrusenko6467 10 ай бұрын
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 10 ай бұрын
1 - No particular reason 2 - Many orders. It's the purchase/sale 3 - Not necessarily, but I don't use mapping libraries
@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 😁
@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 ❤️
@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.
@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 😁
@MahmoudIsmail-rw7hg
@MahmoudIsmail-rw7hg Жыл бұрын
Thank you Milan, l like your explanation
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
You are welcome!
@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
@HelloWorld-th9vb
@HelloWorld-th9vb Жыл бұрын
Liked, waiting for the next one😊
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
More to come!
@mozamilahmadafghan4889
@mozamilahmadafghan4889 Жыл бұрын
Very clearly explained
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Thanks!
@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.
@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
@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.
@nayanchoudhary4353
@nayanchoudhary4353 Жыл бұрын
Nice! Waiting for next
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Will upload soon
@michelchaghoury9629
@michelchaghoury9629 10 ай бұрын
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 10 ай бұрын
Do you make a distinction between domain rules and application/data-integrity rules?
@michelchaghoury9629
@michelchaghoury9629 10 ай бұрын
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
@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.
@MohamedAliSoltani93
@MohamedAliSoltani93 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@MilanJovanovicTech sorry for the second question: it seems two stupid 😅
@sukhdeepdhillon4639
@sukhdeepdhillon4639 5 ай бұрын
Thank you for your videos. one quick question, why not use constructor to validate the creation of object instead of creating factory method. factory method can be useful if the object creating is complex.
@MilanJovanovicTech
@MilanJovanovicTech 5 ай бұрын
I prefer not throwing exceptions if creation fails - which you can't avoid with constructors
@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? 👀
@robertocruzfalcon1622
@robertocruzfalcon1622 Жыл бұрын
Great video as always, thanks! What program do you use to create the diagram? Looks great.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Excalidraw :)
@swift4511
@swift4511 2 ай бұрын
If I have Product, Specification, and SpecificationType aggregate roots, can I refer directly to the Specification instead of just id? Or do I need to get the specifications for each product every time I get the product page? Or maybe should I use separate read/write models?
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
Its fine to fetch them all at once. Fewer round trips to the DB.
@amustafa
@amustafa 9 ай бұрын
Thanks, from my heart!
@MilanJovanovicTech
@MilanJovanovicTech 9 ай бұрын
You're welcome!
@stickyamp5996
@stickyamp5996 4 ай бұрын
Thank you Milan!
@MilanJovanovicTech
@MilanJovanovicTech 4 ай бұрын
Any time!
@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 😁
@ravimungalpara9595
@ravimungalpara9595 Жыл бұрын
Since static methods are not thread safe, is it a good idea to use it while creating objects.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Why would I care about that in the context of creating a Domain entity?
@ravimungalpara9595
@ravimungalpara9595 Жыл бұрын
@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.
@artemvolsh387
@artemvolsh387 Жыл бұрын
Another great video, thanks a lot!)
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Glad you liked it!
@winstochurgle9133
@winstochurgle9133 10 ай бұрын
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 10 ай бұрын
No, not always. Static factory is useful when I want to trigger some side effects after creating the entity.
@helloworld9018
@helloworld9018 7 ай бұрын
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 7 ай бұрын
The ID is still something you can reference, regardless
@pawel131657
@pawel131657 6 ай бұрын
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 6 ай бұрын
I did cover it here: kzbin.info/www/bejne/gpXVfpd_lsd4Z9E
@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.
@Dragonet17
@Dragonet17 Жыл бұрын
Great topic !
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Thank you!
@PatricSjoeoe
@PatricSjoeoe Жыл бұрын
Great video as always :)
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Thank you! Cheers!
@vertikalniserklaz8694
@vertikalniserklaz8694 8 ай бұрын
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 8 ай бұрын
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 8 ай бұрын
@@MilanJovanovicTech in a few words - are Domain Services part of Domain Model?
@vinayakkolhe5909
@vinayakkolhe5909 11 ай бұрын
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 11 ай бұрын
What's the error?
@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 👍
@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
@jodainemoore8300
@jodainemoore8300 3 ай бұрын
Great Videos, Please can you do one on Composition and Or with Strategy Pattern, best struggling with these for months.
@MilanJovanovicTech
@MilanJovanovicTech 3 ай бұрын
Good idea
@jodainemoore8300
@jodainemoore8300 3 ай бұрын
@@MilanJovanovicTech Really? Thank you Your content has been really helpful great quality videos, well thought out/explained
@jodainemoore8300
@jodainemoore8300 3 ай бұрын
I did ask you this a few months back and you gave me an answer I tried it I put together something that works but I wasn't sure it it still conforms to DDD and best practices. 1. Can we use interfaces in DDD Domain Modelling(if Possible is it advisable)? The reason why I was asking is that I was trying to find the best way to model the data below. The backstory is that in my App I need to communicate with Different renderers one renderer I am sending data over TCP and in the other I am writing data to a File. Is it good practice to have different types of Objects In a collection in Json? Or would be better to Split the Data of One Json with the ID and Type I would then make another trip to the database/API using the Id from the first json so that I can get all the 'rendererDatas'. If the below Json is up to standard what's the best way to model this in DDD? [ { "id": "859b6427-a84a-4ac7-1234-21864cf46c86", "name": "string", "description": "string", "rendererDatas": [ { "id": "ea0e7e36-ffe0-6543-83f0-23d46968b2aa", "name": "string", "DataType": "Viz", "description": "string", "IPAddress": "123.123.123", "rendererAttributes": [{"FirstName": "John", "Number": "8"}] }, { "id": "ea0e7e36-6543-6543-83f0-23d46968b2aa", "name": "string", "DataType": "Ventuz", "description": "string", "FilePath": "C:\Data", "Payload": "Json payload with Firstname and Number" } ] } ]
@jodainemoore8300
@jodainemoore8300 3 ай бұрын
The UI that uses this API data has a List of more than object types but has the same base/parent. The User interface needs to do CRUD on the list, so one bit I was not sure about is how should the information be present in the API. So should GetItems() have all the different object types in one list in the response data? Or should it be multiple lists and it's up to the user to manage the data(fetching all the list and merging it in one)?
@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
@ккк-д7ю
@ккк-д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 Жыл бұрын
I don't like side-effects in constructor (raising domain events)
@taner-saydam
@taner-saydam Жыл бұрын
Great, thanks 🤩🤩
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
You’re welcome 😊
@Roshan-tb3iz
@Roshan-tb3iz Жыл бұрын
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 Жыл бұрын
The Product is completely unrelated to an Order. Unless you mean updating the price on a LineItem?
@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
@lourenceplay9017
@lourenceplay9017 7 ай бұрын
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 7 ай бұрын
I don't think 😂
@lourenceplay9017
@lourenceplay9017 7 ай бұрын
@@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.
@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
@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?
@mrwalkan
@mrwalkan Жыл бұрын
How do you map those in databases using EF?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Check out the next video
@shalram02
@shalram02 6 ай бұрын
I am just curious. Why we were using GUID over all instead of Int as type? Is this GUID are sequenced?
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
To be able to provide the Id on the client side, among other things.
@shalram02
@shalram02 6 ай бұрын
​​@@MilanJovanovicTechI really appreciate your quick response.... I see GUID are not sequenced does it benefit us really If our Database is not distributed.
@harshaghanta1
@harshaghanta1 Жыл бұрын
With all of that code added ? Does Sku still need to be a record type ?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Does it?
@ArturoNull
@ArturoNull Жыл бұрын
Thank you!!
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
You're welcome!
@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 😊.
@ThugLifeModafocah
@ThugLifeModafocah Жыл бұрын
email should also be a value object.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Agreed, but didn't want to steer off in that direction
@simonhamelech
@simonhamelech Жыл бұрын
Why did you make the _lineItems list readonly?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
So that it's readonly 😅
@simonhamelech
@simonhamelech Жыл бұрын
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
@DENDYTWOO
@DENDYTWOO Жыл бұрын
Can someone explain to me what does "Aggregate" mean?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
This is from Martin Fowler: martinfowler.com/bliki/DDD_Aggregate.html
@aj.arunkumar
@aj.arunkumar 7 ай бұрын
are you against strongly typed ids?
@MilanJovanovicTech
@MilanJovanovicTech 7 ай бұрын
Not necessarily
@angelldark6426
@angelldark6426 Жыл бұрын
We do not use the interface?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Which one?
@angelldark6426
@angelldark6426 Жыл бұрын
@@MilanJovanovicTech I thought that when creating Customer we should create ICustomers and describe the logic inside it. ? But I'm not sure about that
@_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
@RyptHunterz
@RyptHunterz Жыл бұрын
Hi ! DDD does not respect SOLID principles ? Am I wrong?
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
How does it not respect SOLID?
@TheDuerden
@TheDuerden Жыл бұрын
To be fair - you do cover that here: kzbin.info/www/bejne/nJaXmqiXpN16mKM - I just had to find you doing it somewhere!!
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
It's a bit difficult going over everything in depth on a single video
@TheDuerden
@TheDuerden Жыл бұрын
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 Жыл бұрын
Sorry 🤷‍♂️😅
@kaibe5241
@kaibe5241 Ай бұрын
Just FYI, your title is misleading - you're not actually modelling anything here - you're implementing the domain model.
@MilanJovanovicTech
@MilanJovanovicTech Ай бұрын
Appreciate the feedback
@piejecko
@piejecko Жыл бұрын
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 Жыл бұрын
I focus more on the technology aspects, in general
@piejecko
@piejecko Жыл бұрын
@@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 Жыл бұрын
THOSE. WORD. CAPTIONS. AT. THE. BEGINNING. ARE. SO. ANNOYING.
@MilanJovanovicTech
@MilanJovanovicTech Жыл бұрын
Thanks
@somyarathee
@somyarathee 9 ай бұрын
thanska. lot
@MilanJovanovicTech
@MilanJovanovicTech 9 ай бұрын
Sure thing!
How Strongly Typed IDs Can Make Your Code More Expressive | DDD
12:02
Milan Jovanović
Рет қаралды 35 М.
Is an Anemic Domain Model an Anti-Pattern?
9:54
Milan Jovanović
Рет қаралды 23 М.
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 6 МЛН
Муж внезапно вернулся домой @Oscar_elteacher
00:43
История одного вокалиста
Рет қаралды 6 МЛН
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 89 МЛН
A Natural Path to Domain-Driven Design (evolve your code)
26:05
Milan Jovanović
Рет қаралды 15 М.
Domain-Driven Design: The Last Explanation You'll Ever Need
21:05
Software Developer Diaries
Рет қаралды 10 М.
How To Use Domain-Driven Design In Clean Architecture
30:27
Milan Jovanović
Рет қаралды 112 М.
This Is How the Anemic Domain Model Turns Bad
13:08
Zoran Horvat
Рет қаралды 9 М.
Domain Driven Design en 10 minutos // ¿Qué es y cuando usarlo?
15:15
The Coder Cave esp
Рет қаралды 32 М.
Mapping Domain-Driven Design Concepts To The Database With EF Core
18:06
Milan Jovanović
Рет қаралды 54 М.
Microservices with Databases can be challenging...
20:52
Software Developer Diaries
Рет қаралды 94 М.
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 6 МЛН