Why MVC?

So one of my post after a long time and i still think i will stick to text instead of jumping into video or podcasts.

So i want to talk about introduction to MVC why use MVC what is MVC and why is there so much fuss about it. What i think personally is that the MVC should have been named as CMV why? consider this

A user type in a website  ===> the controler is invoked

now how is that possible what is controller and what invokes it. Regarding the ‘What invokes it’ is kinda detailed part so lets leave that for now. You can assume that there is some magic going on in that part but ‘What is controller’ can be answered. Controller is just a class with different methods. Basically its just a class nothing else.

The controller will then retrive the Data ===> The model is retrived

A model is just the collection of data or data. It can be a list of data or integer or any type of data. We call it model.

The user can see the data ===> the view is rendered

The model is then pushed to the view in which we render the way we want the data to be which can be a table, grid etc.

So its that simple. but is it worth it to divide the code that much and why doing so much work? Well first the logic is seperated from the UI which is testable and we can write unit test on logic which will more clean code and the code is more organized so we can reuse the building blocks.