Think about logic and presentation, where logic is a type of electrical outlet and presentation is a light bulb. You may now have several sockets in your home, some with different sizes. You can also have a bunch of light bulbs in different colors, some cheap, some expensive. The fact is that one lamp can go into one or several socks, and one socket can accept more than one lamp, but you can only match one lamp in one socket at a time.
So, if you have a really good light bulb (or a really good html template), you want to move this light bulb to where you need it (or apply the same logic). And if one day you decide that you want to use the blue light, you can just change the lamp, you do not need to install a completely new electrical connector to change the color.
Returning to the logic and presentation, if you have a general case when you have a form on a web page, sometimes you show this form when the user first loads the page, and sometimes you want to show it after the user has filled in some of the inputs, but maybe , there were errors or missing information. In this case, the logic will not do anything, just show the form or try to process the form, find the error and then display the form that reveals the errors.
You can do this with mixed logic and presentation in the same file, of course, but what happens when several people start editing your script? Maybe the script breaks down and they don’t know what to do, so they comment on some important section to make it work again. It is like someone is about to change a light bulb, and then decides to reset your light switches. But sometimes, when you encounter poor wiring, there is no other way to fix the problem, the problem comes from a simple "Please change the light bulb" to "Make the light work." In a properly designed system where components are isolated in a reasonable way, it is usually easier to fix.
In other words, the mixing logic and presentation are similar to wiring your bulbs using a bare wire, and then connecting the wires to the network without using a circuit breaker.
Roger Halliburton
source share