Yesterday I was reading a book. they talk about MVC pattern is becoming very popular in these days. I think Rails is the really really first web application framework that implemented MVC pattern. For me if I didn’t meet rails, I wouldn’t know about MVC either.
So in this post I will briefly talk about MVC pattern in and easy way to understand more than reading a paper works in the web site. I will try my best though.
Just for the beginners (Me too!!) alright I will explain it one-by-one.
Of course M is standing for Model. I think the easy way to know what exactly mean model is it’s represented things that you want to see. imagine of a super model that walking on the cat walk in fashion TV. I really want you to see this point. okay you want to see all the winter fashion. So you select to go to the winter fashion(winter_fashion table). But how are you going to see the clothes(data). So you need someone to put it on, we called that a model. Now I think you see the point now.
Model is just the object that represent the data in the table.
Note: Clothes (Data) need to represent it by Super Model (Model)
For View, This one kinda easy to understand. I will keep going on that Fashion example. Okay the only one rule of this example is you can not go to see the fashion at the place but you can just watch it at home. So how can you see it at home? You need a television which is like a view in MVC pattern. Because TV just let us see what they look like. You can only see things only by TV (view).
Controller is the one that kinda busy all the time, because it need to deal with both sides (View and Model). Controller control every action the user make it from the view and send the request to controller. After controller know what user need then it goes get data from the model. Back to our example. In our TV we have a lot of channels (tables). not only just the winter fashion that we want to see. some time we want to change the channel. After we press the remote button. The Station will have to check what channel that we requested for. after that the station(controller) need to give as a channel (model) that we want to see
When all of these 3 combine it together. it will look like this
I hope you all will get better with MVC pattern. and if I explain something wrong please leave a comment for me. I need to know it. because we share, right?
By the way Thanks for google and all the web-site that related to those pics up there