D
D
dmitriy2018-06-04 13:58:36
Software design
dmitriy, 2018-06-04 13:58:36

Are you organizing a DTO for the service layer?

I want to organize service classes with detailed documentation, can you tell me from practice how best to proceed?
1. Work with services through DTO
2. Work directly with models, collections (activerecord)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Soprun, 2018-06-04
@soprun

Data Transfer Object (DTO) is one of the design patterns used to transfer data between application subsystems. A Data Transfer Object, unlike a business object or a data access object, should not contain any behavior.

If the service needs to return "data" for the execution of its task, then they can also be very conveniently "packed" in a DTO, then the "service" begins to resemble "Request-response"
Answer to the option: 1
ps. "classes-services" - This is the "Service layer" or "Application Layer", sounds kind of magical-weird.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question