Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Andre' Jones
Andre' Jones
26,671 Points

MVC

Can someone sum up the concept of model view controller for me. I get view and model but i'd like a good explaination on controller specifically. (Overall Concept) Thanks Im sure its in one of the videos but not sure which one.

1 Answer

Patrick Cooney
Patrick Cooney
12,216 Points

So, if you get model and view, controller is pretty simple from there. The controller is the guy that goes out and talks to the view and the model so that they can share information. Think of the model and the view as siblings that are mad at each other. They don't want to talk to each other. Instead when Mikey wants to communicate with Johnny he tells his mom or dad to "tell johnny I said shut up!". In this example the parent is the controller. They act as a buffer between the other two parties which allows data to remain separate from the views. There is a slide attached from the Stanford iOS course (applies to MVC in general) which has a very good explanation of MVC. You can find it on iTunes U. The lines that form a sort of piece sign work the same way as road makers in his example. White dashed are crossable, etc. Notice the double yellow between view and model. Don't pass in a no passing zone!

Stanford iOS Course MVC Slide

Andre' Jones
Andre' Jones
26,671 Points

Thanks, sometimes I start mindlessly going through the tutorials and not seeing the concepts, which im going to fix. Learning other languages has help me realize how important those concepts are.