Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doing MVC or not doing it?

I'm new to MVC structure and feel it's harder to get things done because it's a new way of doing things. Are there anybody who has experience of MVC vs. pages way of doing things. Is the MVC way of doing it the holy graal now or is there still value doing ordinary object-oriented development (or even procedural pages webdev)? Is MVC a fad?

like image 719
marko Avatar asked Dec 22 '22 07:12

marko


1 Answers

A brief list of pros and cons for MVC

Pros

  • Testablily
  • Separation of Concerns - Promotes decoupling between major components
  • Helps you focus on one task/area at a time
  • Natural fit for Web and desktop interactions
  • Fits well with other design patterns, Single Responsibility Principle etc.

Cons

  • Can require more code and effort
  • Can reduce clarity for simple pages (in these cases try to continue using simple pages)
  • Will take more learning

MVC is much more than a fad. It is a very pragmatic way of separating multiple concerns of a web application into manageable and reusable sections. Granted it does take some getting used to at first, but with some conscious effort at breaking your application up the MVC-style can be very rewarding. Often solutions are more succinct as they only need to concentrate on a single operation or task.

It is not a new idea either. It has been around in one form or another since 1979 (@Sarfraz Ahmed's link) and has been used in various web and desktop platforms.

If you are finding yourself having trouble using an MVC-style implementation then try to break it down into the individual parts or actions that are being used, and their corresponding area, model view or controller. As you probably expected, this will come easier over time.

Good luck

like image 134
Redone Avatar answered Dec 28 '22 08:12

Redone