I was shocked to learn that the web application development course did not cover this concept, but it’s more than fair. That class covers so much: VPS hosting, AWS, 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 pattern for the design of applications that hopes to separate concerns and make things as simple as possible specifically for teams. This is synonymous with the S in Solid principles (there’s a link below that has more info, but watch out for a one-byte on it).

Why learn MVC?

Well MVC is web development nowadays. Spring, Java’s web framework uses MVC so does C#’s ASP.net, Javascript does with almost every stack, PHP’s Lavarel. In fact, most modern web frameworks are just MVC versions of popular languages for web development.

What is Model?

This is more complicated than just a database some times it’s a serialized model of the database or just a data structure within the application. But in short, it’s the data that is separate from the functionality.

What is View ?

This is more or less just UI. The View gets info from the Model like a username and then a text object or paragraph element the value is replaced with whatever the username is.

What is Controller?

To understand this I need to explain the role of most web APIs handle requests and

Basically, when the server receives a request in HTTP it needs to know what to do and where to go. When the page is launched and the functionality is requested ie pressing a button. Then the API is triggered. An API is just 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 site kitefans.com

kite fans is a forum, social media, and web 3.0 site for kite enthusiasts to talk and share content. While it is fictitious it is a good example of the usage of MVC. A database of users, posts, and content, a view with buttons and content, and an API to control how content behaves and how database values are used.

You have a frontend guy for your HTML CSS style and layout, a backend serverside guy who sets up the hosting the routes and the API, and a database engineer who sets up the tables and SQL queries. MVC is the best for collaboration.

Postman an API testing tool and HTTP request client is used a lot for collaboration from the UI guys and the API creators. This way no matter what patterns or languages change the group can work together on the same API endpoints. A function that should return the database item of username whenever you hover over a profile picture. It would take all three teams to understand the same functionality from the API.

Keep in mind my definitions are specific to web app development. The general definitions of MVC are very basic and can be found in the wiki link below.

https://en.wikipedia.org/wiki/SOLID

https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

Subscribe to Blog via Email

Enter your email address to subscribe to Layers Media and receive notifications of new posts by email.

Join 82 other subscribers

David Kozdra

David Kozdra is a computer science student at Florida Polytechnic University. He is the Treasurer of the Media Club, Head of Outreach of the Baked Bean Bois improv group, and the Cohost of the Poly Pod podcast.

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.