4.0: MVC Intro
MVC Intro
In this module we'll introduce the Model View Controller pattern that we'll use in both our WebMVC project and our API project later on.
Purpose
The purpose of MVC is used to separate concerns in an application. For our purposes right now, we'll use MVC to help us craft a sleek Web application that will access our Services layer. Let's have a little bit of intro for each part of MVC.
MVC Intro
Model - Models represent objects or C# POCO's carrying data. POCO is a term that stands for Plain Old C# Object. You'll also hear POJO, which stands for Plain Old Java Object. Starting out, to give the definition some concrete bounds, a model represents the data that will be represented in the view and used by the controller to manage logic. Keep it that simple for now. It can have some business logic(validation type of stuff), but for the most part, these will look like simple C# classes with properties in the classes.
View - The View represents the visualization of the data that model contains. The view is often referred to as 'dumb' and simply considering what data will be shown.
Controller - The Controller acts on both the model and the view. It will take a information from the model and pass it to the view, or it might return a specific view after some action has been taken. It controls the data flow into model object and updates the view whenever data changes. In general, it keeps the view and model separate.
Let's start to play with these concepts.
Last updated