tags:

views:

90

answers:

2

Service layer is a outer layer or not? If not then it come under which layer?

Please reply

Thanks

A: 

Depends on what it's oriented with respect to.

+2  A: 

You can organise a system in many different ways, there's not just one layered architecture. I've never used the term "outer" layer. It is even reasonable to analayze the same system in multiple ways Logical Architecture, Physiscal Architecture ...

We can only answer your question if we know what layers your have chosen in the architecture under discussion, it should then be possible to understand where services lie. You have only told us about "outer", we don't know what alternatives there are.

I usuaully think about Presentation, Business Logic and Persistence. In which case Services lie in the Business Logic layer.

I would say that it's quite reasonable to consider services as the public interface for a system and so in some sense they lie in the "outer" layer.

Added in response to comment:

There is not a simple answer to this. It all depends what we mean by "Service" and what our layers are doing. Let's take a concrete example: suppose that our UI wants to display the details of an invoice. We might choose to create a service

InvoiceDto getInvoiceDetails(int invoiceNumber)

It seems pretty clear that the implementation of this service is in the Business Logic layer. And the interface might be a simple library, or a web service depending upon how we communicate between the layers.

Then we decide to expose that service to customers so that their apps can call the service over the internet. We would have some code in the Web Layer that perhaps exposes a REST service

http://dave.org/service/invoice/nnnn

clearly there's a little bit of adapter code running in Web Layer, and there we could manage authentication etc. But where is the service? Is it just that adapeter? Is it the business logic? is it both?

To my way of thinking the real Service is the logic running in the Business Layer, the rest is just plumbing.

djna
I am using 3-tier architecture... And i have front end where user logins and third party verifies the login details for which it checks the detail from the database.. so in this basis i want to know where does service layer lies?
Abhi