Next: , Previous: Generators, Up: Philosophy



4.11 Thoughts about web applications

A lot of modern applications are written for use with a web browser. SiliconBrain later will generate an http version of the defined applications. For web applications in general there are several things to consider.

4.11.1 Generation of html

Sometimes the layout and contents of a web page is dynamic. That is during compile time the html pages are not defined. Rather they have to be generated later out of the data. In some applications I have seen, this leads to a general approach, that all pages are generated while the application is running. Even those pages, which are static. This is to simplify the overall architecture of the application.

But according to the general principle of compile time decisions outperform runtime decisions this idea is deprecated. Instead we distinguish between three basic classes of html output:

static
This are html pages, which are completely defined at compile time and never change. Those pages are installed as ready to display html sources.
semi static
This are pages, which normally do not change, but have to be rebuild time and again. They are based on data, which is not defined at compile time, but varies only rarely. For those pages there is a special program, which rebuilds all the html pages out of semi static data. This program can run for example every day or week.
dynamic
This are those pages which really depend on the input the user of an application has typed into the application. Only those pages are generated while the user is waiting for a response.

4.11.2 Reusable pieces for the generation of HTML

Whether html pages are static, semi static or dynamic: all will have the same kind of styles or techniques with which they are created. There will be common javaScript pieces or the same /title> and other pieces identical in all pages of one application.

For these pieces there should be only one place of definition. There should be not one bit coded redundant in several pages. And so there will be an html generator, which generates all three kind of pages. The generators C-functions will be active in the make of an application to generate the static pages, they will be active in the program, which runs every week or day to generate the semi static pages and the same functions again will be active in the running application to generate the dynamic pages.