What is MVC ? (Release your Blind-Fold)

02 Aug

To build a good and stable software, you need to design your architecture well.. Just like a building, the better architecture, the best quality of building would be done. Software is similar with building. But the different is, Building is built of bricks, cement and roof, while software is built with binary hexadigital code. But if we switch our point-of-view, software and building have many similarity. For example, a building could have a hole, while software either. We will not discuss further about hole, we will discuss about what architecture is good, and i will explain what MVC is. As a brief explanation, MVC is Model-View-Controller. With this architecture, you logically and physically split your code between the code that shown by the user (View), code that operate logical algorithm, access database, controlling flow of program, etc (Controller), and Mapping all tables to class (Model). So, this pattern is provided for object-oriented based application. This architecture was introduced by GangOfFour(GoF) in his book, Head First – Design Pattern. So, what’s wrong with old architecture? check this figure below :


Q: So, is that something wrong with that code?
A: No, i don’t think so.
Q: So, can we develop application with this old pattern?
A: Absolutely yes.

Hey, wait! there’s something wrong with my for loop.

Now, i’m gonna entice you to imagine. Imagine if your PHP code is now 100 lines (remember, 100 lines only PHP code), then there’re somehting wrong inside your code. Is that so easy to be found? Are you sure whethere there are 100% human-error free? How about if you change your PHP code, then you ACCIDENTALLY change your HTML code? then you will find another problem, aren’t you?

Just what i’ve said before, with MVC pattern, you split up 3 big things in application. The architecture is about like this :


Controller is the core of program because it control program flow and error handling. All related with algorithm or logical thing will be handled by Controller.

A: Hey, there’s nothing special with your architecture!
B: Are you sure? what about if you have any error with your traditional architecture?
A: Just fix it!
B: Fixing with handling much time than before?
A: …..
B: Come on, with this architecture, you are so easy to develop application. You split your code, you can design your UI it self without disturbing the whole algorithm.. once you have errors in your algorithm, you don’t have to distract your UI code..and of course, you could work in team, your mate design the UI, you do the logical programming.. Whoaa.. what a team i have!!
A: Really? So i should migrate my architecture to MVC
B: Absolutely, NO!!

Hey, why B answer No? Because MVC is architecture that fit with Object-Oriented Application. MVC can sometime make you easier, but sometime can make you harder to develop application. So, MVC is not the only one architecture, but it’s just an alternative to develop application much easier.

Another case appear. Is that possible if we disable one of three elements?

The answer is, YES. But, MVC only tolerate if you disable Model element. If you prefer native JDBC or native database accesing and querying then Modelling Class, you can disable Model elements and you do query with using old way. But, you can’t disable view and controller elements! These 2 elements are the core of all application. If you disable view, what should be viewed in monitor? Same with controller, if you disable this element, who should control the flow of application?

I will give you some framework that MVC based (all framework are Web-Based application) :
– Zend Framework
– CodeIgniter

-JSF + RichFaces (JSF as Controller, and RichFaces as View)
-Spring + Tapestry (Spring as Controller, and Tapestry as View)
-Struts (As View)
-Hibernate (As Model)


Posted by on August 2, 2009 in English, Programming


3 responses to “What is MVC ? (Release your Blind-Fold)

  1. vitorio santosa

    August 3, 2009 at 9:55 am

    nice post hans…

  2. julius limarta

    August 9, 2009 at 5:56 pm

    kerreeennn……. sayang g gak ngerti pemograman…so… gak ada yang g ngerti isinya..wkwkwkwk..:P

  3. Inge Martina

    December 6, 2009 at 7:50 pm

    maju terus….


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: