Model View Controller (Rinse and Repeat)

There seems to be a lot of debate around what Model View Controller (MVC) is. After almost 48 hours of discussion, intense Googling, and furious debate I believe I can comfortably say that MVC is a way to organize your code. To compare, there are dozens of ways to organize a craft room. On top of those dozens of ways you could think of to organize your stuff - there are overarching theories and methods to help. I've read articles on the psychology of organization and popular methods such as bundling your stamps based on theme versus month of the year you would use it. MVC is a method of organization for programmers.

Keep in mind a lot of the implementation is dependent on the project itself. Also, a programmer's code is personal and nothing beats methods that work for that programmer. With that in mind, MVC attempts to propose an ideology to follow. Model can be a folder to store sets of data and any logic used to filter through that data. View's purpose is to hold any visual templates that the user sees. Controller is a storage place for created routes and their attached code that makes them work. An app.js is still required and functions like an index page in a book - it links all of those files in one place.



We took a previous project, the robot directory from last week, and integrated this new organizational method. My file structure now looks a bit different. In the future, I probably wouldn't implement MVC for a project this small but the purpose of the activity was to get familiar with thinking in an MVC way.

If you follow this link: https://github.com/victoriarainc/week-05-day-02-daily you can follow the changes I made in the comments. Anything following 'EDITED:' is the reason for moving those specific lines of code into another location. It was an exhausting process but I'm grateful for the chance to go through the logic 'risk-free' on a completed project.

Comments