What the heck is wrong with me? Why am I writing about this…
Let me apologize ahead of time to whoever ends up reading this because this is almost definitely not going to make sense the first time someone reads it, which is sort of what this is all about anyways… Okay, here goes.
Today I’m sitting here at home. I’m going over a few things, trying to update my brain before I attempt the daunting task of trying to assemble an application and get some of my work done. I’m going over some of the basic theory behind Ruby on Rails and the first thing that comes up is the architecture. And I know everyone has experienced this before, when you end up reading through a tutorial somewhere trying to get some concept and syntax pounded into your brain, then suddenly there is a massive over usage of reoccurring and conflicting words? I’m honestly growing increasingly discouraged by encountering this. Let me explain what’s bothering me today:
MVC Architecture. Or rather the words that compose the acronym MVC. Model – View – Controller. Now let me explain to everyone what MVC means. You have a web application developed. Now this application can access a database or not, it doesn’t really matter for this architecture, and really, the beauty of MVC architecture is it really doesn’t matter what happens when a user accesses your site, it pretty much just handles all models of a dynamic web page. But oh wait, I just used the word model, the very first word in MVC. HMMM. Okay, let’s start from a different angle here. Model REALLY just means component. I know, that’s strange right? But a model really is just a component and I can’t classify that any more simply than that.
Joomla!
The simplest, most logical, and easiest framework ever made(not just opinion, it’s the most used) is Joomla. While Joomla doesn’t support Object Oriented Programming, it supports PHP and it’s powerful enough for most peoples uses. Joomla is broken down as follows–
You have the standard stuff:
Framework: Joomla
Language: PHP, CSS, HTML, JavaScript
Database: typically mySQL
Then how you use Joomla:
Template: CSS, HTML, PHP, and JavaScript, working together to display all of the following:
Plug in: something that enhances or adds new functionality to Joomlas FRAMEWORK.
Component: Basically an application that is integrated into Joomla.
Module: some type of visual element for your site.
Joomla! as a computer
The beauty of a website is it’s basically just a big computer. You have your operating system that handles everything for you. That would be the framework itself. Next you have programs that you use to do many different things like type documents, email, browse the web, listen to music, and so on. A web version of this is called a component. Then you have modules, which for the most part, hidden or not, operate in the same way a GUI element of your computer. A module is similar to a widget, task bar, or notification tray, regardless of what it’s actual function is. A plug in may sound a bit trickier, but when you think of it like a computer, it’s more like a codec pack that lets you decrypt a unique file type, or maybe a driver that lets you access previously unavailable hardware. A plugin really just enhances the framework. Maybe one of these days I will draw this as best as I can.
Back to why I’m ranting…
Model
But back to MVC... Model = it equals a freaking component! Component is a better word, even though I do believe that model does work. The model encapsulates data from the database, kind of caching it, much like a computer application encapsulates program specific data. Another commonly thrown about word when trying to represent a “MODEL” is OBJECT. Objest works for me. It’s much closer to the word component, but doesn’t really have the full sense of action attached to it that component has.
View
View is probably the most complicated portion of this as it SEEMS like it represents two things, that really aren’t all that different. View handles what happens immediately before the user sees something in the browser. So really, view does concern user output, so SHOULD include the browser translation, output, the user reading it, and user understanding and trying to interact with it.
Controller
The controller manages the actual processing whether or not it means taking information from the user and then accessing the database, accessing a component(model), or just using the controller to immediately return values.
All together now…
The view(user, browser, visuals; all with the ability to make something dynamic happen) talks to the framework directly through the server side programming. The framework itself is the controller. Which I guess is the same way in Ruby on Rails, Rails being the controller of all of Ruby‘s actions.
So in conclusion:
So you may be confused about this a little bit more now that I mentioned Joomla‘s architecture and how it works, but let me now connect the two. RoR isn’t like Joomla because Joomla uses server side scripting langauge(PHP) and never an Object Oriented Programming langauge like Ruby. But Joomla and Ruby on Rails, and PHP, ASP, Python, etc… can all use MVC. So wait, Joomla! also uses MVC? And so does RoR, and PHP and ASP and Python can use this too? Okay, now we’re getting this clarified. It’s nothing more than concept, theory, and a rule that people should follow but don’t have to. Some things use this, other things CAN use this, but it’s all really a strategy for what happens when a user interacts with your site. Why is this always talked about in such a way that makes people not understand it at first. Ughh!!!
Now if you are just now getting into both of these this is terribly confusing and I feel sorry for you because I have been working with this stuff a long time and I still have trouble wrapping my head around it.
Good stuff. No more problems, this all makes sense. But hey, look at this stupid chart:

Now I’m not saying anything bad about this chart. It looks good, it’s your standard MVC chart. But what the heck is up with there being a man on browser, view, controller, AND model. Those aren’t people!!! Why do the view and the model have the same man with the suitcase? The controller makes sense, but why does it have to be a person also? The fact is, ONE OF THESE is ACTUALLY a person. And that should be standing on the other end of the browser. I love this architecture. It works amazingly well but why the heck are there pictures of people in every step? FAIL FAIL FAIL!!! This is the SAME crap I experienced in my Java 2 class back in college. Lots and lots of explanations that never explain anything. This is why I changed majors! Come to think of it, my professor couldn’t explain to me how a model was different from a component either. I’m pretty sure he said they were the same. Fun.
I finally understand the architecture enough to understand what happens in each step and why it’s important at simplifying and organizing my sites. But when will somebody give a clear and easy to understand(non-conflicting) demonstration of MVC.


Twitter
MySpace
Facebook
FriendFeed
Orkut
Digg
Delicious
Stumble Upon
Technorati
LinkedIn
Flickr
YouTube
Picasa Web Album
Last.fm
Google Profile