9

I read a lot of questions about this concern, and some of them are

Presentation VS Application layer in DDD

Application layer vs domain layer?

So my question is if the top layer is REST API and there is no need for any UI, is REST api considered as a presentation layer or application layer?

Update

Since I received some comments how this question has nothing to do with DDD and that there is no presentation layer in DDD etc, not to confuse application layer in OSI etc.., I decided to add this .

It appears that there is also an distributed interfaces layer that would actually handle this scope.

So basically presentation layer is a part of DDD architecture, just not the heart of this architecture. Also web services in a form of .net web api (rest) would exist in this distributed interfaces layer.

enter image description here

4
  • In the links you provided it is already said that DDD is about the domain. I am not sure your question has much to do with DDD. Can you rephrase your question reflecting that.
    – simoraman
    Commented May 12, 2016 at 4:34
  • 3
    Where did you get this diagram from? Commented May 12, 2016 at 7:25
  • You have two questions. 1. Could REST api be considered as a presentation layer in DDD? 2. If there is no need for any UI, is REST api considered as a presentation layer or application layer? But you have failed to supply reasons you need to know the answers to these questions. This is causing confusion. Commented May 12, 2016 at 12:53

2 Answers 2

6

REST is a protocol and convention that sits on top of HTTP. It is neither the Application Layer nor the Presentation Layer. It isn't considered part of the OSI model at all.

HTTP is considered the Application layer.

Don't confuse the Application Layer in DDD with the Application Layer in the OSI Model; they are not the same thing. DDD does not appear to have a Presentation Layer in practice.

A "Layer of Abstraction" is just that; a layer of abstraction. It's a place for you to put code and to establish API protocols. Your abstraction may differ from mine. There's no "one ring to rule them all," nor is there "The One True Way."

5
  • My question was about rest api not just rest in general . I was referring to DDD when using onion architecture example infoq.com/news/2014/10/ddd-onion-architecture , not just domain layer. Commented May 12, 2016 at 6:32
  • In the diagram you provided, REST is part of the Distributed Interfaces Layer. The infoq article you linked has neither an Application Layer nor a Presentation Layer. Are you sure you're reading these diagrams properly? What, specifically, do you want to know? Commented May 12, 2016 at 7:20
  • Isn't this article based on jeffreypalermo.com/blog/the-onion-architecture-part-1 ? What about layers defined here dddsample.sourceforge.net/architecture.html ? Commented May 12, 2016 at 9:00
  • culttt.com/2014/09/29/creating-domain-services is mentioning "The Application layer is how the outside world communicates with the model. This could be through HTTP requests, an API or through an automated messaging service." Commented May 12, 2016 at 9:09
  • 1
    @DarioGranich" What exactly are you trying to figure out? The diagram is as plain as day. In that architecture, the REST interfaces live in the "Distributed Interfaces Layer." It would seem that you're reading a bit too much into this. If you told us why you need to know, we could probably better assist you. What specific, real-world problem are you trying to solve? Commented May 12, 2016 at 13:47
0

In the OSI model? your REST api is running in a user application that talks to the application layer (layer 7).

In REST, the primary role of your api is hypermedia data transfer, which is to say converting domain concepts to/from hypermedia representations. That's probably best described as an application concern, rather than a presentation concern.

Put another way, the message that you are sending to the client is a representation of application state. So I think you can make a pretty compelling argument that you are sending that representation from the "application" layer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.