Coding Concepts
Coding Concepts
  • 3
  • 86 612
Entities
A straightforward guide to understanding Entities in Domain Driven Design.
Let's Connect 🤝:
codingconcepts.io/connect
Переглядів: 907

Відео

Repository Pattern
Переглядів 68 тис.3 роки тому
A concise guide to understanding the Repository Pattern for cleaner, more maintainable code. Let's Connect 🤝: codingconcepts.io/connect
Value Objects
Переглядів 18 тис.4 роки тому
A simple guide to effectively using Value Objects in Domain Driven Design for richer, more cohesive code. Let's Connect 🤝: codingconcepts.io/connect

КОМЕНТАРІ

  • @benisrood
    @benisrood 14 днів тому

    This is your brain on Java and "industrial programming".

  • @futsuchinpo9892
    @futsuchinpo9892 2 місяці тому

    thanks man

  • @jimbobwylie
    @jimbobwylie 4 місяці тому

    Why do you only have 2K subscribers?! This is the only one of at least 10 previous videos that has explained Repositories for a true beginner to understand! And this video is 3 years old. Thank you for this!

  • @AlexLavrik
    @AlexLavrik 4 місяці тому

    Best ever explanation of Value Objects!

  • @kieljnsz
    @kieljnsz 5 місяців тому

    Thanks man! Please post more

  • @InfoAufArabisch
    @InfoAufArabisch 7 місяців тому

    Could you please elaborate more about the test problem at 02:24 till 02:45? I don't understand how this makes it harder to write a test

    • @CodingConcepts
      @CodingConcepts 7 місяців тому

      Of course! At 2:24 I was trying to illustrate a scenario where a lot of logic resides in the controller. When you see "thick" or "bulky" controllers like this, it becomes very difficult to test your code because of the dependencies these controllers are using. ie: a database. The design at 2:45 is improved because it moves the database dependency out of the controller and into the repository. This puts us in a position to use a Mock for our repository to better target the specifc area of code we're looking to test. Hope this answers your question. Happy Coding! Rob

  • @rasindurawishanka7541
    @rasindurawishanka7541 8 місяців тому

    carry on, brother. amazing explanation. we need clean architecture explanation.

  • @xiaoxiaoxiao2043
    @xiaoxiaoxiao2043 8 місяців тому

    Best video of explaining meaning of entity in DDD. Thanks !

  • @supa.scoopa
    @supa.scoopa 8 місяців тому

    Brilliant videos!

  • @andrey_aka_skif
    @andrey_aka_skif 9 місяців тому

    The Repository pattern seems simple. Great! I need to implement it in my project! I'm making it. Fabulous! Wait... I need filters... Damn. What I should do? Should I add filtering methods to the repository? It is a bad idea. I need to read the Internet. Hmm... CQRS? Now I have to use the Repository only to update the business object. To get composite data I have to use Queries. They are not so clean anymore. They usually know about the database type. What's the result? The simple idea of a Repository results in a complex mess of Repositories and Queries. Usually there is also a Unit of Work running nearby. What do you think about compound queries in the context of the Repository?

    • @CodingConcepts
      @CodingConcepts 9 місяців тому

      For most cases it’s usually acceptable to have different method definitions. -FindByName -FindByEmail -FindByPhone etc.. If your query is particularly complex, or it needs to be used in other areas of the system, typically complex business logic, you may want to look into the specification pattern. In short, you would encapsulate the query logic inside the specification object, and then inject that specification wherever needed, in this case, a repository. Happy Coding! Rob

  • @johnnymoreno4575
    @johnnymoreno4575 10 місяців тому

    Excellent content. Thank you for sharing. Is there a sample code base that we could look at to see implementation of these principles?

    • @CodingConcepts
      @CodingConcepts 10 місяців тому

      Thanks for the comment! Unfortunately no sample code at the moment.

  • @adevinwild
    @adevinwild 11 місяців тому

    Happy that you're back! :)

  • @tolgakaragol3263
    @tolgakaragol3263 11 місяців тому

    A great explanation. Thanks! I am wondering how InStock could be 13:28 ?

    • @CodingConcepts
      @CodingConcepts 10 місяців тому

      Good question! Context is everything of course, but in general I would expect this responsibility to be part of some inventory tracking service. Adding the InStock property to the book would violate the Single Responsibility Principle as it's not a core attribute to the book. If we were to add the InStock property to the Book, the question we would be asking is "Is this exact book in stock?" Where in most cases we probably just care about "Of all the books with this title, is one available?" Hope that clears things up for you. Happy Coding. Rob

  • @m3hdim3hdi
    @m3hdim3hdi 11 місяців тому

    what is the difference between the DAO and the Repository pattern?

    • @CodingConcepts
      @CodingConcepts 11 місяців тому

      There is a pretty good discussion I had in the comments about this with another viewer. I linked the comment below. Let me know if that clears things up. ua-cam.com/video/x6C20zhZHw8/v-deo.html&lc=UgwoV2MDbSnxx_sXtFR4AaABAg

    • @titobundy
      @titobundy 5 місяців тому

      @@CodingConcepts I don't see the discussion. Is the url correct?

    • @CodingConcepts
      @CodingConcepts 5 місяців тому

      @@titobundy Sorry about that. I'm not seeing the comment any more. I will post the discussion here. Question: I might be confused but i find this pattern really similar to the use of Data Access Objects. Are there any differences ? Should we be using one over the other ? Reply: A Data Access Object (DAO) is all about data persistence. It will sit below the Repository, and will match one to one with an underlying database table or view. It's an object representation of the underlying data schema. It's logicless. The return type of a repository is going to be an Entity or Aggregate which are business objects. They may closely resemble the underlying data schema, but you're getting business objects back. Which will have some form of business logic in them. In general, you'll see DAOs used in more complex architectures, to handle specific persistence requirements. Question: So if i understood correctly, they are used together and DAO will return data as JSON for example, when Repository will cast it to Business objects (and perform other operations) ? Do you have some tips on how to know if we should use DAO, repository or both ? Reply: A repository is an abstraction of a collection of objects. A DAO is an abstraction of data persistence. A UserRepository should only ever return User. It shouldn't for example return a RoleObject. A UserDAO on the other hand, it would be acceptable to return information about a User and have another method to return information about it's Roles. As it's only concern is how the information is persisted/stored in the database. The key thing to note here is it's just returning data for you. A good use case for a DAO would be when the underlying data schema is very complex. Perhaps, that UserObject needs several database operations behind the scenes to construct. Put logic like that in a DAO, not a Repository. An Object Relational Mapper (ORM) such as Entity Framework, is going to eliminate the need for a DAO in most cases. It's going to do most of that work for you.

    • @titobundy
      @titobundy 5 місяців тому

      @@CodingConcepts Thank for your post. I would like to have your point of view. Do you think tools like TypeOrm or Spring Data, which apply the repository pattern, do so according to Martin Fowler's definition in his book Refactoring or perhaps Eric Evans in his book DDD, or do you think such implementations are closer to what DAO offers?

    • @CodingConcepts
      @CodingConcepts 5 місяців тому

      @@titobundy I can't speak specifically to TypeOrm or SpringData as I haven't used those tools before, I mainly use Entity Framework. But in general, I would say both. Modern ORM's are applying the repository "by the book" but are also becoming exceptionally well at mapping complex data objects. I would expect the need for a DAO layer to decrease over time.

  • @dimpho.ngache
    @dimpho.ngache 11 місяців тому

    Great content

  • @dimpho.ngache
    @dimpho.ngache 11 місяців тому

    This is by far the best video I found on UA-cam that explains entities in detail. Keep up the good work!! Looking forward to more content

  • @SuhasBharadwajK
    @SuhasBharadwajK 11 місяців тому

    This is such high-quality content, man! Superb production. You deserve tons of more subscribers. Maybe pushing more videos every week will do the trick.

  • @doointhedoo
    @doointhedoo 11 місяців тому

    Great videos. Subscribed. Would like to see more industry real life examples. Especially this part ( 10:46 ).

  • @fodiecamara965
    @fodiecamara965 Рік тому

    Post more videos

  • @sonictailsandsally
    @sonictailsandsally Рік тому

    Thank you! I had the gut feeling this vid would give me the answers I was looking for. Should have watched it first and saved time!

  • @ashishchandra4078
    @ashishchandra4078 Рік тому

    Great explanation , thank you :)

  • @infiniteloop5804
    @infiniteloop5804 Рік тому

    I don't comment often on videos, but this video definitely deserves a THANK YOU!!

  • @twentxx
    @twentxx Рік тому

    Man, this is very good video Thank you 😊 We will waiting for your videos

  • @mb3_media
    @mb3_media Рік тому

    Man, that is the bet explication about that design pattern that I've seen. Thank you so much for your effort

  • @newagene8276
    @newagene8276 Рік тому

    What can be done for other complex operation how to segregate those in terms of repositories? outrside crud we might need more methods in a large software

  • @jasontaylor8304
    @jasontaylor8304 Рік тому

    Awesome video! Very clean and clear and explanation is spot on.

  • @egor.cleric
    @egor.cleric Рік тому

    What about aggregation root?

  • @Johnny-pf1ni
    @Johnny-pf1ni Рік тому

    Great explanation on the Repository pattern. It makes so much sense to me now.

  • @CandiceWilliams_
    @CandiceWilliams_ Рік тому

    I wish I had more time to pick this up so I know how to communicate with my devs and explain how I need to be able to access payment history and user referrals with my flutter app so I can create reports to keep my affiliates and stockholders up to date… if any one has any tips please share. I appreciate you so much in advance.

  • @slowmollyfar
    @slowmollyfar Рік тому

    Thanks a lot for these explanations, illustrations nice as well

  • @noblenetdk
    @noblenetdk Рік тому

    impressingly precise and consice. Haven't seen this explained that clear before. Do the pattern have any drawbacks? Keep up the good work!

    • @CodingConcepts
      @CodingConcepts Рік тому

      Interesting question! I haven't thought about it from this context. There isn't an obvious tradeoff or drawback that comes to mind. I would say the biggest debate I've seen regarding the pattern has delt with specific implementations. Particularly when injecting an Object Relational Mapper (ORM) such as Entity Framework, which already implements the Repository Pattern (with unit of work) itself and will lead to code duplication and violation of the DRY principle (Don't Repeat Yourself).

    • @pictzone
      @pictzone Рік тому

      @@CodingConcepts Why would you inject an ORM if you already created a custom data access layer with the repository pattern? The only reason I see where you would reach such a situation is if your main data access is already an ORM and you also integrate your own repository for more custom work. Wouldn't this scenario only create complementary code, thus not violating the DRY principle? (i mean it's still not 100% DRY, but still reasonably well)

    • @CodingConcepts
      @CodingConcepts Рік тому

      ​@@pictzone Great question! There is no definitive answer to this and it really comes down to the trade-offs you're willing to accept. I find myself writing my own repository classes because I find it makes my code much more testable. I'm a strong advocate for Test Driven Development (TDD) and I believe good code is testable code. By writing my own repositories, I'm able to easily mock their return values with testing tools such as Moq. I'm able to reduce the duplicate code it creates, which you've correctly identified, by using generic repositories in a lot of cases. ORM tools do provide in memory testing tools, but I just don't find the usability as streamlined as Moq. So for me, I find the trade off of increased testability at the cost of some duplication acceptable.

  • @andianwar5784
    @andianwar5784 Рік тому

    come back bro

  • @andreigudumac4328
    @andreigudumac4328 Рік тому

    Hoping that you make some more videos on design patterns. Thank you. Keep up the good work!

  • @arsenhakobyan00
    @arsenhakobyan00 Рік тому

    This is such a great video. I'm so glad I found your channel. Are you planning on creating more videos like this?

  • @utkachannel4411
    @utkachannel4411 Рік тому

    wow, thank you very much !

  • @mohamedQ
    @mohamedQ Рік тому

    nice and easy to understand straight to the point thx a lot

  • @naelshichida7940
    @naelshichida7940 Рік тому

    Hey man, thanks so much for this. Me, Dom and Max love your work.

  • @shywn_mrk
    @shywn_mrk Рік тому

    I just found this video and your channel. Please continue your amazing work again and keep creating these kind of content 💪🏻

  • @adamnorman85
    @adamnorman85 2 роки тому

    Really helpful 👌

  • @nikhilgoyal007
    @nikhilgoyal007 2 роки тому

    thanks very much!

  • @zeshanrabnawaz1699
    @zeshanrabnawaz1699 2 роки тому

    Great Job Buddy ......

  • @MsLiberanimus
    @MsLiberanimus 2 роки тому

    the best explanation ever 🙌🙌🙌

  • @tsunamio7750
    @tsunamio7750 2 роки тому

    This is not simply an explanation on the repository pattern. This video reaches about so many principles that young engineers have a hard time acquiring. I already knew all of those concepts but never truly acquired them. You shine bright so strong on those concepts that I now not only understand them, but I also have intuition and instinct about looking out for improvements like those to decouple and reuse code. There is no code per se, yet it did serve as a wonderful example.

  • @maretzelaltar7833
    @maretzelaltar7833 2 роки тому

    this is the only video where I was able to understand Repository Pattern. Short but the way the lesson is delivered is clear and easy to digest.

  • @abymathew575
    @abymathew575 2 роки тому

    really good video with good diagrams. Expecting more videos from you.

  • @josephthecreator
    @josephthecreator 2 роки тому

    Amazing video, thank you.

  • @TramoTech
    @TramoTech 2 роки тому

    👍

  • @Knigh7z
    @Knigh7z 2 роки тому

    In DDD your repositories should be per aggregate rather than business object. An aggregate may be a business object but it may be more than just one, depending on your needs to enforce consistency during a write. This usually works well with the repository as you'll open a transaction as part of the repository operation.

  • @dylan8389
    @dylan8389 2 роки тому

    Absolutely amazing video, as a relatively inexperienced developer I’m currently learning C# and this video has made complete sense to me.

  • @drewb9
    @drewb9 2 роки тому

    This was the best explanation of the Repository Pattern. Thank you for this.