I was shocked to learn that the web application development course didn’t cover this concept, but it’s more than fair. This class covers so many things: VPS, AWS hosting, domains, HTML, CSS, JS, PHP, WordPress, etc. I want to use this time to go over the most important concept in modern web development. Model View Controller a model for designing applications that hopes to separate concerns and make things as simple as possible specifically for teams. It is synonymous with the S in Solid principles (there is a link below which has more information, but beware of a byte above).
Why learn MVC?
What is the model?
It’s more complicated than a simple database. Sometimes it is a serialized model of the database or just a data structure within the application. But in short, it’s the data that is separated from the functionality.
What is sight?
It’s more or less just the user interface. The view gets information from the model such as a user name, then a text object or paragraph element whose value is replaced by the user name.
What is the controller?
To understand this, I need to explain the role of most web APIs that handle requests and
Basically, when the server receives an HTTP request, it needs to know what to do and where to go. When the page is launched and the functionality is requested, that is, by pressing a button. Then the API is triggered. An API is simply a function that is triggered and returns HTTP requests or responses.
With all this new knowledge, let’s look at a simple scenario for the kitefans.com site.
Kite Fans is a forum, social media, and website 3.0 for kite enthusiasts to discuss and share content. Although it is fictional, it is a good example of the use of MVC. A database of users, posts, and content, a view with buttons and content, and an API to control content behavior and the use of values in the database.
You have a frontend guy for your HTML CSS style and layout, a server side backend guy who configures the hosting routes and API, and a database engineer who configures the tables and SQL queries. MVC is best for collaboration.
Factor API testing tool and HTTP request client are used a lot for UI guys and API creators collaboration. That way, whatever models or languages change, the group can work together on the same API endpoints. A function that should return the username database item every time you hover over a profile photo. All three teams should understand the same API functionality.
Keep in mind that my definitions are specific to web application development. The general definitions of MVC are very basic and can be found in the wiki link below.