Separation: two difficulties

zhaozj2021-02-16  80

I don't know when, we learned to use "separation" as a tool for handling things: complex things are separated by layers, separately, free to change one, no effect, this is the advantage of separation .

When learning the programming language, pack a certain function into a function, as a black box, which is a separation: the function itself only needs to consider the things and passing parameters in the box, it feels like hiding A relatively narrow space, it is necessary to consider this part of the function, not worrying about things other than space, nature is easier to develop.

The box outside the box does not need to know how to implement it in the box, just know that the feature is indeed, and the value you want is returned by the return value. In this way, once you need to change your ability, you only need to change a function function, but the main structure of the program does not have to change.

When we developed web design and web applications, we also tried to use some way to achieve separation, one of which is template.

The people who are familiar with PHP will know that many PHP procedures are not mixed with HTML together, but write a web page template, and then replace the specific string in the template, and finally return the generated data.

Because this can separate the code of the application and the code of the appearance of the web page. You can design another set of templates, providing the same preset string interface to replace the PHP program, without changing the program, changing the appearance of the web page, like the famous PHP forum phpbb is doing this.

Because the code of the part of the template does not contain any dynamic programs, it can also be regarded as a normal HTML, editing any HTML editor.

The PHP program also considered many of the issues that put that program to output such a program, and only need to know and prepare the data of the "Feeding" template.

So we can think that template is limited to the format of PHP output, making it in a smaller functional range, and we need to consider the problem, it is more convenient to design it.

By now, we have implemented web design with Web standards, which is important to achieve the separation of content and performance, use semantic, structured tags, instead of describing the marks describing the appearance to write HTML.

Such all performance styles can be designed with a laminated style sheet (CSS), different style sheets, as long as the same HTML structure is designed, allowing the page to change the style at any time.

At the same time, the symbolic tag can make the user agent used by the disabled person to understand and clear how the document should be explained in their own way, which is absolutely noted when mixed performance and content.

How beautiful is it, but it is not as good as possible.

转载请注明原文地址:https://www.9cbs.com/read-12432.html

New Post(0)