Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I cannot grok MVC, what it is, and what it is not?

I cannot grok what MVC is, what mindset or programming model should I acquire so MVC stuff can instantly "lightbulb" on my head? If not instantly, what simple programs/projects should I try to do first so I can apply the neat things MVC brings to programming.

OOP is intuitive and easier, object is all around us, and the benefits of code reuse using OOP-paradigm instantly click to anyone. You can probably talk to anybody about OOP in a few minutes and lecture some examples and they would get it. While OOP somehow raise the intuitiveness aspect of programming, MVC seems to do the opposite. I'm getting negative thoughts that some future employers(or even clients) would look down upon me for not using MVC technology.

Though I probably get the skinnable aspect of MVC, but when I try to apply it to my own project, I don't know where to start.

And also some programmers even have diverging views on how to accomplish MVC properly.

Take this for instance from Jeff's post about MVC:

The view is simply how you lay the data out, how it is displayed. If you want a subset of some data, for example, my opinion is that is a responsibility of the model.

So maybe some programmers use MVC, but they somehow inadvertently use the View or the Controller to extract a subset of data.

Why we can't have a definitive definition of what and how to accomplish MVC properly?

And also, when I search for MVC .NET programs, most of it applies to web programs, not desktop apps, this intrigue me further. My guess is, this is most advantageous to web apps, there's not much problem about intermixed view(html) and controller(program code) in desktop apps.

like image 244
Hao Avatar asked Dec 31 '22 02:12

Hao


1 Answers

I like the way Martin Fowler puts it :)

http://martinfowler.com/eaaCatalog/modelViewController.html

.. and from http://martinfowler.com/eaaDev/uiArchs.html :

Take Model-View-Controller as an example. It's often referred to as a pattern, but I don't find it terribly useful to think of it as a pattern because it contains quite a few different ideas. Different people reading about MVC in different places take different ideas from it and describe these as 'MVC'. If this doesn't cause enough confusion you then get the effect of misunderstandings of MVC that develop through a system of Chinese whispers.

like image 190
cwap Avatar answered Jan 01 '23 15:01

cwap