Model View Controller Concept

Standard

Concept

MVC is one of the most used patterns that used by web developers to develop their web. Not only because it’s easy to understand, it’s easy to implement once it’s fundamental component is created.

The concept was made to separate bussiness logic and view logic to avoid confusion between these components.

Model

Model is everything that is related to bussiness logic layer such as data and the rules that manages data.

View

View presents data to user. The key concept of view is template. Provided with many sets of data, view can presents data to user with purpose to make user understand these data.

Why can’t user see the data directly? Visualized data is easier to understand than plain data.

How could you look a series of number when you can see them in a chart? Yes, because we prefer visualization.

Controller

Controller is like a bridge between previous components. It’s used to provide the logic about how are system supposed to show the data.

For example:

We have two different datasets that have different format. With the power of controller we can separate how to visualize the data. Yes, we can use simple logic like “if A then use View A or else use View B”.

Advantages and Disadvantages

There are many advantages of this concept. We can clearly separate these components (view and data logic/model) so it doesn’t interfere each other because there isn’t single bussiness logic code in the view and otherwise.

The other advantage is it becomes easy to add more features because it’s modular and scalable. It removes the complexity of building some big system later though it’s really complex when we build the skeleton of the system.

And because of the separation, the code is much more structured and it’s easier to test.

We can do the funcionality test only without much interference of the UI.

Leave a Reply