... | ... | @@ -6,3 +6,19 @@ The team chose to use MVC (Model, view, controller) structure for the main sour |
|
|
|
|
|
|
|
|

|
|
|
|
|
|
Brief exp
|
|
|
Here's a brief explanation of how these components interconnect.
|
|
|
|
|
|
**Model**: This is where the business logic and data reside. For example, “Grocery” encapsulates the data (like grocery items) and the operations that can be performed on this data (like adding or removing observers)
|
|
|
|
|
|
**View**: This is the user interface. It displays the data to the user and takes user input. View is responsible for creating the visual representation of a grocery item.
|
|
|
|
|
|
**Controller**: This is the intermediary between the model and the view. It takes user input from the view, processes it, and updates the model. Classes like “HomeController” and “PantryController” handle user interactions and update the model and view accordingly.
|
|
|
|
|
|
The interconnection works like this:
|
|
|
|
|
|
- The user interacts with the view (for example, checking a box next to a grocery item).
|
|
|
- The view sends this user action to the appropriate controller (like `ShoppingListController`).
|
|
|
- The controller processes this input - it may update the model (like marking a `Grocery` item as checked) and then tell the view to update itself.
|
|
|
- The view gets the updated data from the model and displays it to the user. |