How useful is a clean MVC implementation?

I work for a company that provides custom CRM-like software. We are currently redesigning / reprogramming the software, hoping that it will look more modern and easier to develop and customize for future customers. Currently, it takes a long time to configure each new application.

There is a presumption that the reason it has been taking so long is related to the amount of business logic present at the view level. To some extent, I can vouch for the fact that this is true, but the symptoms do not always reliably indicate the cause. It has been suggested that if we simply move the business logic to the controller level and use a clean look (we use java J2EE and struts), as when implementing struts tags instead of calling the bean level and iterating the objects directly to jsp - etc. and etc.

Before I begin to defend, we move forward, I wanted to get an idea of ​​what other people thought. Does a β€œclean” MVC implementation (especially the emphasis on decoupling the controller and presentation) provide a cleaner, easier development and change to the code base?

Thank you all for your contribution - it helped alot

+5
source share
5 answers

Your goal should be to get your business logic in one place. In my experience, if you can do this, your code base will be easier to develop, maintain, and modify.

Model-view-controller is a way to get to this point, although in classic MVC business logic is in the (domain) model, while application logic is in the controller.

Application logic : if the next user inspection date is within a week (or expired), display the schedule check screen, otherwise display the "Inspection history" screen.

Business logic : restaurants that have not previously inspected inspection should be checked every six months, seafood restaurants should be checked every year, and all other restaurants should be checked every two years. Given that this last inspection of the restaurant, when does their next inspection require?

+10
source

The denouement always does it. It does not matter whether MVC or not, the smaller the connection in the system, the easier it is to maintain and change. MVC is just a good template for the Web that simplifies the decoupling of that.

+3
source

MVC suggests that intelligence must be appropriately divided. This means that the presentation and model would be ridiculous, and the controller is a smart guy. This implies that we can create changeable guys and smart guys smoothly. These benefits are very strong when code requirements / corrections are effectively included. Added abstractions are a pain until you understand the patterns used. This is server side MVC. What about MVC at the end of client code?

From time to time it is very true that models of views have different intellects built into them, and are encoded into business delegates. However, it is better to use custom tags. The most annoying thing about jsp pages for me is when they mix javascript with code. This smart code is actually trying to manipulate the DOM and leads to inconsistent tags in static jsp code.

You have the luxury of starting from scratch. Life would be easier if everyone used unobtrusive javascript (a different language from java and simpler than the crap I saw in the production code) and custom tags (not so difficult). Another pain point is not compatible with W3C html / css. A huge problem with browser issues if you have something like that.

PS: Statements for a long conversation :)

+2
source

Someone said this:

"Any problem in computer science can be solved with the help of another layer of indirection"

But I do not remember who the author of this quote is. Somebody knows?

+1
source

I work for a company that follows MVC quite strictly, and we have had great success. We were able to develop the basic services that live in the controller and reuse them for several projects. In addition, the controller layer also facilitates unit testing and code reuse.

+1
source

All Articles