Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

 
As a programmer new to Ruby who has recently debunked the command line tools issue when starting with Ruby on a Mac you are now ready to begin in earnest your Ruby on Rails or RoR (you know how us Geeks love our acronyms) coding career.
The MVC programming pattern is used in Ruby on Rails and it can be a little confusing if you are new to programming in general or a veteran coder. The acronym M-V-C stands for Model-View-Controller and each has a specific function for your web application.

  • Model – Contains application data, logic, rules, functions
  • View – The visual representation of said data, rules, logic, etc.
  • Controller – Mediator between the Model and View

Ruby chart
If that seems a bit abstract to you let’s think of it in another way.  View – it’s your eyes. You see what is going on. What do you do with those visual elements? You pass them along your Controller / central nervous system until they get to your Model / brain.
So let’s say that your View is a large, angry looking ferret staring you down with its dark, beady eyes. After your controller has sent that data to your Model it will most likely tell you do adjust your view by turning and moving in a rapid speed in a different direction.
After you have eluded the wily ferret your View is a lovely picnic in front of a pristine lake. Your controller sends this new data to your Model and it decides to sit down and have a delicious avocado sandwich.
Now your view is that you are out of avocado sandwiches (oh no!). So you pass that data along the Controller to your Model which decides to go home (I mean what’s the point if you don’t have avocado right?)
If that analogy didn’t sit well with you perhaps a webpage will. The HTML would be the Model, the CSS the View and the browser the Controller.
This is my long-winded way of telling you that the Model is the data, logic, or information of your program. The View is the visual representation of it and the Controller is the traffic cop that directs them.
Hopefully this helps you understand the MVC pattern a little better and I will be back next month to continue our journey.

More To Explore

Creative

Getting B2B Results on Social Media

There are plenty of well known B2C brands that are killing it on social media. Wendy’s has gained thousands of followers and fans with their

Contact Us

  • This field is for validation purposes and should be left unchanged.

Rob Womack

If there’s anyone who can honestly say, “Been there, done that,” it’s Rob. After traveling the world for seven years in his 20’s, Rob went to LA and started working in film production. Then it was off to New York, where he learned how to program, which eventually brought him back home to Louisville to build websites. At Current360, Rob heads up our in-house production studio, creating all things digital for our clients — videos, commercials, radio spots, and a lot more. 

When he’s at home, Rob likes to create things like homemade kombucha and music.