You have just joined a small team that runs a college's notice website. It was written in a hurry, years ago, by one person, and it lives in a single file: index.php, fourteen hundred lines, with SQL queries, HTML tags and business rules all tangled together. This week two requests land on your desk. The principal wants the same notices to appear in a mobile app. And on Thursday evening, when exam results go up, the site crawls and then times out.
Look at what is behind these two complaints. The first is about how a web application is organised inside: where the rules live, where the SQL lives, where the page is drawn, so that a new screen does not mean copying a file and breaking three others. The second is about copies: the same result page is asked for by thousands of students, and it is silly for the server to rebuild it every single time when a copy kept somewhere along the road could answer. The first is what this chapter calls architecture, with MVC, frameworks, tiers and services as its vocabulary. The second is caching.
By the end you will be able to trace one request through Model, View and Controller and say which part does what, and you will know why Django calls the same idea MTV and what MVVM changes. You will explain what a framework gives you (routing, templates, an ORM) and read a small piece of each. You will pair the usual frameworks with their languages, tell a CMS from a framework, separate layers from tiers, and weigh a monolith against microservices and a single-page app against server-rendered pages.
Then you will read cache headers: Cache-Control, Age, ETag, If-None-Match, 304 Not Modified. You will say which copy lives where, decide how long it may be reused, bust a stale one, and compute how much time a given hit ratio saves.