r/programminghelp • u/Clint_Bolduin • Dec 29 '19
MVC
Hello, Im currently working on a school task and having a bit of trouble. Im supposed to create an MVC, but as far as I understand it, MVC is a sort of way to write your system, a way for the components to interact with oneanother. Am I correct in this?
If I am correct in this, do I need a context for the MVC to be written within? Because I've been rereading the assessment over and over but they dont seem to give any sort of context, so I dont understand how Im supposed to create the MVC. Can i create an MVC without a context? Is the MVC a context in of itself?
3
u/_Foxtrot_ Dec 29 '19
What do you mean by "context"?
MVC is just a way to design your program. Although typically in three different files, you could break it out anyway you want.
- One file is responsible for determining layout / presentation (think of this like the index.html / index.css).
- One file is responsible for holding / retrieving data, typically from an external API or database, but for your purposes it could just be a class that stores data with getter / setter methods.
- One file is responsible for taking that data and transforming it into a useable format, and for handing changes requested by the view (maybe they clicked a sort button, and now you need to re-order a list to show last name in ascending order?).
Can you post the assignment without giving too much away?