From the course: JavaScript: Patterns

Model-View-Controller (MVC) pattern - JavaScript Tutorial

From the course: JavaScript: Patterns

Start my 1-month free trial

Model-View-Controller (MVC) pattern

- If you've been programming for a few years, you may or may not have heard of the Model-View-Controller pattern. But it is often the first thing you learn as you grow more experience as a developer. This pattern basically defines how an application should be split, and often reflects how your modules are organized within three simple categories, models, views, and controllers. The model is where your data resides, where you define your schemas and the models for your data. The views is where you have your views, or in most cases, the pure HTML of you application, where the visuals are. And finally, the controllers are where you have your logic of your application, the functions that makes your application run. Following this pattern, most developers split all the files and structure of their application following this pattern. And even sometimes name the folders with these labels. Nowadays, this approach to splitting your application has evolved especially with applications like React. Which is more MVVM? I will explore this shortly, but it remains the basis of how most frameworks and applications are structured. Having a good understanding of what this pattern is will go a long way to understand how most applications are organized.

Contents