Why don't we put business logic in the services? Will we ever replace our services?

I am developing a system, and I have read many articles that do not say that business logic does not enter service code. And just put your business logic in your domain objects.

I do not place my service code anywhere, and my presentation level accesses it directly. In the future, I might want to expose this service code through the IIS WCF service.

But I do not understand why services should be easy? What is its advantage? When will we ever replace our services? Please explain

+4
source share
2 answers

The idea is that, having different layers in his application, he makes it reusable. For example, your business layer might have a feature for checking books. Well, you can take this function and call it from different layers. A Console application can call it, a service can call it, or a web page can call it.

In addition, it is easier to test. You can call the method in an example application that just calls your BLL, and you don’t have to worry about your service calling it.

+2
source

Source: https://habr.com/ru/post/1394480/


All Articles