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 trialJoseph Kawa
1,807 PointsWhy is KaraokeMachine class not in model folder?
Just curious about this, it would seem to be easier to build this directly inside the model folder instead of having to remember to import the song and songbook classes. Is this sort of a best practice?
1 Answer
Mark Rae
4,503 PointsThe idea is to divide up your program into 3 separate segments: model, view, and controller (often abbreviated MVC). The (data) model is just storage structures, no real behaviors. The view handles only the way things appear to the user. Finally, the controller deals with the logic between the two. Rough example: you click a "delete" button in the view, the controller understands the button and changes the model to remove the element and tells the view to show it as deleted.
I'm not surprised you found it confusing. I thought it was odd that the videos started using this framework without explaining what they were doing first.