MVC – design pattern

Quick introduction to Model-View-Controller

One of my target is writing about Ruby on Rails. So today we start. This article will be about main software design pattern in Rails. We call it MVC – Model View Controller.

But from the beginning. What is software design pattern? Hmm… it is like good recipe for chocolate cake. Many people do chocolate cake onces better, others worse. But when we have good recipe we share it with others. They try and tell what they think about it. If it really good many people started using. The same is with software design pattern. It is some of good practices or solution how to manage with common software design problems.

So MVC is like good recipe for chocolate cake. We use it only in special case like web applications.

MODEL – He talk with database and controller. Database is like ingredients: chocolate, milk, flour etc. Model have methods to do something with ingredients: stir, blend and bake.

VIEW – It is rendering by controllers. For web applications this is page which we see in ours browsers. To create this page we use HTML, Java Script and CSS. So we can say it is for us ready cake.

CONTROLLER – It is like cook (chef). It take ingredients, transform through model methods and send to view. So controller give us prepared cake.

I wish you good luck with yours own MVC application. I will write about Ruby on Rails application later so please look for new article here.