What do I call the code that orchestrates my web application?
In MVC, for a lightweight application, many people will put the logic of their application into the controller. However in reality the controller should be light weight and be only tasked with marryin开发者_StackOverflow社区g the logic in the model with the view.
My question: What is the name of the pattern/what should I call the thing that orchestrates the logic in my application? From initial reading I got the impression this was called a "Service", however I have read many things since that have muddied that idea.
Generically speaking, the logic typically goes in the Model but it's difficult to keep a starkly clear line between the Model / View / Controller.
That would depend on the kind of application you are working with. If the application is a lightweight application and is not going to be maintained for years or doesn't need flexibility of lot of business requirement changes then you could almost put your logic anywhere you like!
Having said that, there are very few such applications (if you intend to earn living out of it) that don't need flexibility. So something that may seem naive at this point but turn out otherwise in future.
Coming to the name of the pattern Service is good but would suggest you to look at this article on Domain Driven Design and this related stackoverflow discussion. Again DDD may be overkill for a lightweight application and traditional Controller, Service, DAO pattern should be good enough.
Hope that helps.
Try Business Delegate design pattern. It does exactly what you are looking for - orchestrating the entire application logic.
精彩评论