Chapter 3. Basic Design Pattern Concepts
Large organization is loose organization. Nay, it would be almost as true to say that organization is always disorganization.
If you only have a hammer, you tend to see every problem as a nail.
Because things are the way they are, things will not stay the way they are.
The MVC Loosens and Refocuses Programming
Way back in the 1970s when user interfaces (UIs) were fairly primitive, a programmer decided to separate key elements of what was required in a graphical user interface (GUI). Each of the parts was given a specific task, and each part communicated with the other parts. The parts were grouped into domain objects and presentation objects. The domain objects were for modeling what perception the user was given of the real world, and the presentation objects were what was viewed on the screen. The parts were divided into a model, a view, and a controller, and the Model-View-Control (MVC) design pattern came into being.
The domain element in the MVC is the model. The model is responsible for what is variously called the data, business, or application logic. For example, take a thermostat. Within the thermostat is a value that represents a temperature, either the actual ambient temperature or a value where a heater is turned Off or On. Somewhere in that thermostat you have a set of data that can be envisioned as set into variables:
$a = current temperature $b = turn off heater $c = turn on heater ...
Get Learning PHP Design Patterns now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.