Baklava is composed of a few dozen sheets of filo pastry stuffed with nuts and soaked in a honey sauce. The process of creating the dessert is rather simple. Five or six sheets of filo pastry are place on top of each other, the top filo sheet is buttered, a layer of ground nuts is smoothed over the layers, and some of the honey mixture is poured over the filling and the filo. This process is repeated until you have used all of the ingredients.
When completed and ready for the oven, you have used about 36 sheets of pastry, three layers of filling, and a cup or so of the honey sauce. If you are like one of the authors, you will also have a huge mess to clean up in the kitchen.
Were you to build this dessert dynamically, you would only need one sheet of pastry and a simple description of the filling and the sauce. When it was built, in the oven, multiple copies of the sheet of filo would be used and the filling and sauce would be added when needed. Suddenly the ingredients (and resulting mess in the kitchen) for the creation of a complex dessert become negligible, and the process becomes simplified to the point where a multi-layer dessert essentially flattens into a pancake.
The best part of this process is you can create other delicacies, such as spinach and feta pie, using essentially the same instructions and ingredients.
The method of building a static web site is very much like creating that dessert. Each page in the site is a sheet of filo pastry. Physically laying one page over the other and adding the content?the filling and sauce?before moving on to the next page is how you build the static site?the dessert.
The dynamic method only requires one sheet of pastry?a template?and a database containing both text and pointers to the location of the sauce and filling. The dessert is built in the oven?the middleware?by allowing the pastry to call the database, ask for the ingredients (as they are needed), and create the finished pastry as outlined in the directions?the code?in the template. The finished pastry is then handed over to the customer?the browser?for consumption. When you build the dessert this way, a few things happen:
The site is built much more quickly and efficiently because it is essentially code-driven and requires less building and maintaining time.
You can immediately accommodate those with nut allergies?personalization?by changing the ingredients in the filling.
The structure of the site flattens. One page is able to accommodate the needs of many users, rather than many pages being built to accommodate the anticipated needs of a few.
In this manner, you suddenly regard a complex, multi-layer dessert in terms of a single layer… a pancake. You are dealing with complexity, as one of the authors is fond of saying, from a position of simplicity.