Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • Thanks for the explanation Ewan. I still have a doubt. Reading your explanation, I suppose in monoliths, where usually multiple modules live within the same application, presentation logic should be placed inside controller (in case of a REST scenario). In this case, if a service returns an entity, I guess I could make an “aggregator” class that assembles the DTO. Do you think that this “aggregator” should interact with other, again, services or directly with the data layer (for example, through a repository)? Commented Aug 24 at 17:37
  • It can interact with whatever it needs to? Can you maybe describe your application, what tech stack are you using, archtecture etc? Commented Aug 24 at 18:33
  • 1
    Ok, so in this setup the front end team control the presentation, so they should make two calls, getBooking, which returns a Booking entity with a ClientId and (if they want it) a second call to getClient which returns a Client entity. Commented Aug 25 at 13:33
  • 1
    They will moan that this is slow because they are lazy, but if you think about it, they probably already have the Client object and can reuse it. so its actually faster and better design overall. as both endpoints are reusable for many presentations, rather than being coupled to the presentation layer for this particular front end. Commented Aug 25 at 13:35
  • 1
    If they are incapable of writing javascript to do this stuff, then you can add a "backend for front end", intermediate layer which basically just does the same thing, but server side Commented Aug 25 at 13:36