What can I name the code that organizes my web application?

In MVC, for an easy application, many people will embed the logic of their application into the controller. However, in reality, the controller should be lightweight, and it will be instructed to marry the logic in the model with the view.

My question is: What is the name of the template / what should I call the thing that organizes the logic in my application? After the initial reading, I got the impression that this is called the "Service", but I read a lot, as it hid the idea.

0
source share
3 answers

It depends on the type of application you are working with. If the application is a lightweight application and will not be supported for many years or does not need the flexibility of many changes to business requirements, you can almost put your logic anywhere!

Having said that there are very few such applications (if you intend to earn a living) that do not need flexibility. So, something that may seem naive at the moment, but otherwise it will turn out differently.

The approach to the name of the template Service is good, but I would suggest you read this article on Domain Driven Design , and this is related to fooobar.com/questions/751552 / .... Again, DDD may be redundant for a lightweight application, and the traditional controller, Service, DAO should be good enough.

Hope this helps.

0
source

In general, the logic usually goes in the Model, but it is difficult to maintain a clear line between the Model / View / Controller.

+1
source

Try the Business Delegate . It does exactly what you are looking for - organizing the entire application logic.

0
source

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


All Articles