Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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 UserService.java? why we seperate it to two objects?

like image 862
lovespring Avatar asked Jan 24 '14 18:01

lovespring


People also ask

What is the difference between application layer and domain layer?

Application Layer: Mediates between the Presentation and Domain Layers. Orchestrates business objects to perform specific application tasks. Implements use cases as the application logic. Domain Layer: Includes business objects and the core (domain) business rules.

What is a domain layer?

The domain layer is an optional layer that sits between the UI layer and the data layer. Figure 1. The domain layer's role in app architecture. The domain layer is responsible for encapsulating complex business logic, or simple business logic that is reused by multiple ViewModels.

What is the difference between domain model and application model?

The main difference between them is that domain services hold domain logic whereas application services don't. As we discussed in a previous post, domain logic is everything that is related to business decisions.

Is Service Layer a model?

In service-oriented architecture (SOA), the service layer is the third layer in a five-abstraction-layer model. The model consists of Object layer, Component layer, Service layer, Process layer and Enterprise layer.


1 Answers

The Domain Model contains information and functionality related to what it means to be a User. It should map conceptually onto something that exists physically in the real world or a clearly defined concept in the problem space.

The Service contains information and functionality related to performing atomic units of work. It should map conceptually onto tasks that are performed on or by members of the Domain model. A single atomic task performed by clicking a button in the application generally involves many members of the Domain working together, unless you app is just a CRUD-y electronic filing cabinet.

like image 189
Affe Avatar answered Oct 04 '22 20:10

Affe