Separating concerns
Proper architectural design is essential for any project that needs to scale. Anyone can prop up some studs and build a garden shed, but a house or skyscraper takes careful planning and engineering. Software is no different; simple scripts can get away with shortcuts such as global variables or manipulating class properties directly, but as the program grows, our code needs to isolate and encapsulate different functionalities in a way that limits the amount of complexity we need to understand at any given moment.
We call this concept separation of concerns, and it's accomplished through the use of architectural patterns that describe different application components and how they interact.
The MVC pattern
Probably the most enduring of these architectural patterns is the model-view-controller (MVC) pattern, which was introduced in the 1970s. While this pattern has evolved and spun off variations over the years, the basic gist remains: keep the data...