Questions tagged [service-layer]

A Service Layer represents one application boundary and consists of a set of available operations from the perspective of interfacing client layers. It encapsulates the application's business logic, controlling transactions and coordinating responses in the implementation of its operations. In enterprise OOP it is often the glue between an application's Model/Data Layers and its Presentation Layers.

A Service Layer represents one application boundary and consists of a set of available operations from the perspective of interfacing client layers. It encapsulates the application's business logic, controlling transactions and coordinating responses in the implementation of its operations. In enterprise OOP it is often the glue between an application's Model/Data Layers and its Presentation Layers.

This excerpt was heavily borrowed from Martin Fowler's book - http://martinfowler.com/eaaCatalog/serviceLayer.html

395 questions
229
votes
5 answers

Difference between Repository and Service Layer?

In OOP Design Patterns, what is the difference between the Repository Pattern and a Service Layer? I am working on an ASP.NET MVC 3 app, and am trying to understand these design patterns, but my brain is just not getting it...yet!!
Sam
  • 15,336
  • 25
  • 85
  • 148
90
votes
4 answers

Fat model / thin controller vs. Service layer

I have been developing enterprise applications for many years using .Net My apps usually have a domain model containing entities mapping to SQL DB tables. I use a Repository pattern, Dependency injection and a service layer. Recently we started…
67
votes
6 answers

Should a service layer return view models for an MVC application?

Say you have an ASP.NET MVC project and are using a service layer, such as in this contact manager tutorial on the asp.net site: http://www.asp.net/mvc/tutorials/iteration-4-make-the-application-loosely-coupled-cs If you have viewmodels for your…
erg39
  • 817
  • 1
  • 6
  • 13
63
votes
9 answers

Service Layer vs Business Layer in architecting web applications?

I know this might sound silly but I am finding it hard to understand the need of a service layer and its differences with business layer. So, we are using asp.net mvc 2 and have Data Access layer which does all the querying with the database and…
Vishal
  • 12,133
  • 17
  • 82
  • 128
61
votes
3 answers

Are Doctrine2 repositories a good place to save my entities?

When I read docs about repositories, it is often to work with entities & collection but in a "read-only" manner. There are never examples where repositories have methods like insertUser(User $user) or updateUser(User $user). However, when using SOA,…
Trent
  • 5,785
  • 6
  • 32
  • 43
48
votes
2 answers

Should the repository layer return data-transfer-objects (DTO)?

I have a repository layer that is responsible for my data-access, which is called by a service layer. The service layer returns DTOs which are serialized and sent over the wire. More often than not, services do little more than access a repository…
JulianR
  • 545
  • 1
  • 4
  • 7
47
votes
2 answers

When is it necessary or convenient to use Spring or EJB3 or all of them together?

I'm a little confused by the mixed use of JSF2+Spring+EJB3 or any combination of those. I know one of the Spring principal characteristics is dependency injection, but with JSF managed beans I can use @ManagedBean and @ManagedProperty anotations and…
user2018726
  • 638
  • 2
  • 12
  • 23
39
votes
1 answer

Separating the service layer from the validation layer

I currently have a service layer based on the article Validating with a service layer from the ASP.NET site. According to this answer, this is a bad approach because the service logic is mixed with the validation logic which violates the single…
Benjamin Gale
  • 12,977
  • 6
  • 62
  • 100
37
votes
5 answers

ASP.NET MVC Business Logic in Domain Model vs Service Layer

I have been reading about where to put business logic in ASP.NET MVC Project for a while and I still can't get clear on some things. 1 - Domain models. What are these really? In my Model folder I have only a bunch of classes corresponding to my…
34
votes
2 answers

How to inject in @FacesValidator with @EJB, @PersistenceContext, @Inject, @Autowired

How can I inject a dependency like @EJB, @PersistenceContext, @Inject, @AutoWired, etc in a @FacesValidator? In my specific case I need to inject a Spring managed bean via @AutoWired: @FacesValidator("emailExistValidator") public class…
Mahmoud Saleh
  • 33,303
  • 119
  • 337
  • 498
32
votes
3 answers

Why use service layer?

I looked at the example on http://solitarygeek.com/java/developing-a-simple-java-application-with-spring/comment-page-1#comment-1639 I'm trying to figure out why the service layer is needed in the first place in the example he provides. If you took…
joe martinez
  • 331
  • 1
  • 4
  • 5
29
votes
3 answers

what's the difference between service layer and domain model layer

for example, I have a user table, to be layer-ing, I create such POJOs: UserEntity.java UserDao.java UserBO.java (business object, domain model?) UserService.java (for service layer) what's the difference between UserBO.java and…
lovespring
  • 19,051
  • 42
  • 103
  • 153
28
votes
2 answers

The Purpose of a Service Layer and ASP.NET MVC 2

In an effort to understand MVC 2 and attempt to get my company to adopt it as a viable platform for future development, I have been doing a lot of reading lately. Having worked with ASP.NET pretty exclusively for the past few years, I had some…
Brian McCord
  • 4,943
  • 7
  • 32
  • 44
25
votes
2 answers

Should service layer accept a DTO or a custom request object from the controller?

As the title suggests what is the best practice when designing service layers?. I do understand service layer should always return a DTO so that domain (entity) objects are preserved within the service layer. But what should be the input for the…
Vino
  • 2,111
  • 4
  • 22
  • 42
23
votes
1 answer

MVC3 App/Service Layer/Repository Layer/POCO Classes/EF4 - Questions!

I am new to this whole design concept, and in reading for the last few weeks I have gathered a lot of information, but it seems scattered and conflicted. Terms are mixed, and I am just having a hard time wrapping my mind around this. The pattern I…
Sam
  • 15,336
  • 25
  • 85
  • 148
1
2 3
26 27