DDD & REST - Domain Driven APIs for the web - Oliver Gierke

Sdílet
Vložit
  • čas přidán 27. 07. 2024
  • Recorded at SpringOne Platform 2016.
    Speaker: Oliver Gierke
    Slides: www.slideshare.net/SpringCentr...
    While Domain Driven Design is supposed to take care of complexity in the very core of software, REST is usually treated a plain remoting technology. In this talk we're going to explore some commonalities of the two when it comes to the design of both the domain and resources. We're going to discover how a good domain design is essential to build a great REST API in the first place and which means REST provides to make your APIs more domain driven. From all of the building blocks of DDD, the talk identifies the ones most important when it comes to building a good REST API: we're going to look at aggregates as natural boundaries for representations, repositories as the backing foundation for collection resources and how hypermedia allows to make domain specific state transitions explicit.
  • Věda a technologie

Komentáře • 41

  • @raphasteps
    @raphasteps Před 3 lety +3

    Amazing presentation, Oliver. 🇧🇷

  • @Lahiru_Udana
    @Lahiru_Udana Před 3 lety

    Very helpful. Thank you so much.

  • @1testrad
    @1testrad Před 3 lety

    Thanks a lot ... very helpful video ...

  • @stgiaf
    @stgiaf Před rokem +1

    The book actually is called "REST in Practice" and it is by O'REILLY

  • @sebastianszczebiot345
    @sebastianszczebiot345 Před 3 lety

    18:28 can you please give some example how to extract model from database?

  • @denniszhang2147
    @denniszhang2147 Před 6 lety

    Great talk! Thanks

  • @danyboomz
    @danyboomz Před 2 měsíci +2

    Now with java 21, you can code value objects with Java records ;)

  • @Lordrainor
    @Lordrainor Před 7 lety +10

    Watching this damn late, god dammit, I love this talk.

  • @andrzejpurtak6811
    @andrzejpurtak6811 Před 4 lety +6

    If you know anything about DDD, watch from 30:00

  • @leowilliams6848
    @leowilliams6848 Před 6 lety +60

    I think this presentation missed the boat on the implementation of DDD in some respects, particularly the point of simplification. I stopped the video and read the 100 pages. However, when he said Entity + Repository = Aggregate, he completely lost me. The definition of an Aggregate is a group of associated objects which are considered as one unit with regard to data changes. A Repository does not change. It is a vehicle for change. The repository, based on my reading is not a part of the aggregate. It is an infrastructure instrument the aggregate interacts with. I could be dead wrong, but that was my takeaway from the reading. Also, the sub-classing of string I don't think adds clarification to the code. It actually does the opposite. As a developer, how can you tell what class the attribute is derived from, without digging further into the code? I think as developers we are tempted to over-complicate things that aren't truly complicated, as if it somehow adds a magic or degree of prestige to what we are doing. My takeaway from DDD is that the objective of tackling complexity in the heart of software is to reduce it as much as possible to something that is universally understandable within a given context, not shift, or add to complexity within a context.

    • @georgeFulgeanu
      @georgeFulgeanu Před 6 lety

      That Entity+Repository it's really not an aggregate, missed the point a little there. Spring people tend to implement any architectural pattern that really fits correctly. so many ideas in ddd are nice, maybe one or two of them are a bit of an overkill

    • @NiekVervaeke
      @NiekVervaeke Před 6 lety +20

      I think he just meant to say that when you see an entity which also has a repository for it, then that entity is an Aggregate. This is because aggregates are the only things that you create repositories for, because all actions should be performed on the aggregates. Aggregate is read / adjusted / saved as a whole and consistency is maintained.
      Aggregates are in essence also entities. They are just the root entity.
      In his example you would have an Order aggregate (root entity) which contains a set of LineItem entities but you would only have an OrderRepository, not an LineItemRepository.
      This is also how it is explained in the book Implementing Domain Driven Design

    • @ITech2005
      @ITech2005 Před 4 lety

      You're thinking about aggregates from a DDD perspective. Entity and Repository are functional aggregates. For example, an abstract Entity class with a dependency on the Repository.

    • @heraldo623
      @heraldo623 Před 4 lety

      @@NiekVervaeke I thought Entites where the building blocks of the domain model. By domain model I mean the things that exists even when the application does not exists. Domain is a term used to decouple bussiness rules from the application, from the mechanisms that are emplyed to enforce those rules. We have always Costumers and Orders, so they belong to the Domain. But we need a mechanism to make this domain work (how to process that orders, how to record that data...), here comes the Application. I could have a business that does not employ computers, all processes could be managed throught paper notes. My repository could be a paper pile or a digital database stored in a HDD, depends on the application. I know that the Repository could be simple an interface located in the Domain Model, you could employ dependency inversion to make the domain agnostic to the application. But does the repository concept belong to the Domain Model?

    • @sebastianm7556
      @sebastianm7556 Před 4 lety

      @@ITech2005 In that case it's an association and not an aggregate.

  • @heraldo623
    @heraldo623 Před 4 lety +8

    I thought Entites where the building blocks of the domain model. By domain model I mean the things that exists even when the application does not exists. Domain is a term used to decouple bussiness rules from the application, from the mechanisms that are emplyed to enforce those rules. We have always Costumers and Orders, so they belong to the Domain. But we need a mechanism to make this domain work (how to process that orders, how to record that data...), here comes the Application. I could have a business that does not employ computers, all processes could be managed throught paper notes. My repository could be a paper pile or a digital database stored in a HDD, depends on the application. I know that the Repository could be simple an interface located in the Domain Model, you could employ dependency inversion to make the domain agnostic to the application. But does the repository concept belong to the Domain Model?
    In Clean Architecture, Uncle Bob makes a clerly difference between Repositories and Entities, where repository is a concept that lives in the application, not in the domain model.

    • @TristanOnGoogle
      @TristanOnGoogle Před rokem

      in a DDD application, you may have at least 2 kind of "entities", domain entities used to form aggregates in the domain model and persistent entities (JPA entities for example) filled with persistence annotations and mapped on domain entities (and also mapped on tables in the database of course) . About repositories, u answer your own question imo : the definition of the repository (the interface) belongs to the domain. P.S. : it's a shame that the presentation is so abstract past the few first slides, a full code example would have been really useful.

  • @dipanjanm
    @dipanjanm Před 10 měsíci

    On HATEOS it reduces coupling between client and server but doesn't it increase chattiness between them because now the client has to call the service for reflecting every small change in them ?

  • @mayboroda
    @mayboroda Před 7 lety +2

    Thanks

  • @wernervogt2610
    @wernervogt2610 Před 7 lety +1

    very methodically

  • @saikrir
    @saikrir Před 6 lety +1

    Seriously good!

  • @mayuranchalia
    @mayuranchalia Před 7 lety +1

    why would you add whole object as member of another object , rather than just holding a id reference...then you are solving Jackson serialization issue

    • @piddubetskyy
      @piddubetskyy Před 7 lety +2

      Because to get to 5th child I'd have to make 5 requests

    • @kanthPL
      @kanthPL Před 7 lety +1

      Not really. Just request 5th child via ES or create explicit API for every member relationship /a/b/c/d/f

    • @PatrickCornelien
      @PatrickCornelien Před 6 lety

      of course, but usually JPA based systems have relationships modeled as properties and thus jackson would try to fetch them. Oliver didn't say that this would be the case if you use IDs instead of relationships, but then you also loose some benefits from JPA.

    • @leowilliams6848
      @leowilliams6848 Před 6 lety

      I think this presentation missed the boat on the implementation of DDD in some respects, particularly the point of simplification. I stopped the video and read the 100 pages. However, when he said Entity + Repository = Aggregate, he completely lost me. The repository, based on my reading is not a part of the aggregate. It is an infrastructure instrument the aggregate interacts with. I could be dead wrong, but that was my takeaway from the reading. Also, the sub-classing of string I don't think adds clarification to the code. It actually does the opposite. As a developer, how can you tell what class the attributes are derived from? DDD is supposed to simplify code, not add complexity. We're tacking complexity at the heart of software, not contributing to it. What if you have 100 attributes. Do we create a class that subclasses string 100 times. I don't think this is a prudent approach, if that is indeed what he is doing.

  • @sohrabsheykhmohammadi1909
    @sohrabsheykhmohammadi1909 Před 2 měsíci

    Amazing, thanks

  • @VinyJones2
    @VinyJones2 Před 7 lety +1

    great thanks

  • @G0rynych
    @G0rynych Před 6 lety +1

    Really bad example of order status ((.

  • @sinch5
    @sinch5 Před 2 lety

    Cool

  • @soumitripattnaik
    @soumitripattnaik Před 4 lety +2

    For the people who are complaining about Spring Data Rest being horrible, you know whats even more horrible cigarettes, but companies still make them and people still buy them.
    Point being,
    Spring Data Rest is an optional add on which is not shoved down your throat, take it or leave it, don’t be a cry baby.

  • @smaaktosuip_za5531
    @smaaktosuip_za5531 Před 3 lety

    Why is it whenever i watch a talk or research an unfamiliar technology, the language with the most issues regarding implementation, is always JAVA 😂.

  • @tav1119
    @tav1119 Před 3 lety

    Blablablabla

  • @Boss-gr4jw
    @Boss-gr4jw Před 5 lety +2

    Spring Data REST is one one the worst frameworks ever build. Violates all the design principles and marries your application to the vendor every way possible.

    • @tofuyam7361
      @tofuyam7361 Před 5 lety

      You are pretty much coupled once you drink the spring boot koolaid

    • @sztigirigi
      @sztigirigi Před 2 lety

      I also cannot believe that they talk about that in context of DDD.

  • @TheNomadSoul1988
    @TheNomadSoul1988 Před 4 lety

    Please stop taking the Lords name in vain.