Web Language Philosophy and Tutorials

Draft - still under construction

The purpose of this and the accompanying articles is not to teach the details of any specific part of the language. Such information is readily available from many sources.

You are reading this in order to learn how to think while using the language, how to write poetry and not doggerel, how to be a good programmer, coder, or author.

Language

In natural languages, if you think in one language while speaking or writing in another, you end up with something known as pidgin. It does allow you to communicate, but not especially well. To native speakers of the language you will appear illiterate.

Similarly you can write very precisely or very sloppily, and you can use very simple words or use arcane words that send readers to their dictionaries.

When working with any language, it's essential that you understand the purpose of that language and its natural use, and that you use a form of language appropriate for the target audience.

The same is true of artificial languages.

Principles

Always keep it simple.

If you can't express an idea simply, you don't really understand it yourself.

Be intelligent, not smart.

Making changes to a program without breaking it requires you to be at least as intelligent as the person that wrote the original. In order to correct bugs you must be even smarter than they were; the original author did make a mistake after all. If you yourself happen to be the original author, you are in the unfortunate position of having to be significantly smarter than you were when you wrote it.

The easiest way to ensure that you are, is to write in a simple natural way without employing any smart tricks. The result might not be quite as efficient or concise, but it will be more beautiful, and it will potentially save many people, including yourself, many hours of frustrating work in the future.

Be effective, not lazy.

Be explicit; don't rely on implicit rules or side-effects. Saving yourself a few seconds or minutes of work now is not worth the frustration and annoyance that your work will continually produce.

Write for your audience, not for yourself.

If you are writing a personal diary, you can write in whatever fashion you wish. But if you are writing for someone or something else, you need to cater to their needs and purposes, not your own. That is true even if that someone else is yourself, wearing a different hat.

Web Page Languages

When writing web pages, in addition to the natural language of the data itself, you will need to think in three distinct languages. It is extremely important to remember the primary purpose of each language and not to usurp the next level by using a language for something it is not intended for.

The following three documents describe the philosophy behind each language. The more you can keep their distinct purposes separated, the better your resulting web pages will be.

HTML
Define meaning and intent.

The target audience is software. Use HTML only to mark up the natural data so that it can be understood by computer programs. Do nothing to control its eventual appearance or presentation.

CSS
Define visual layout and appearance.

The target audience is human beings. Use CSS to control the visual appearance of the data only. Be concerned about the appearance of individual types of data, not the data itself or the physical media upon which it will be displayed.

JavaScript Problems
Use JavaScript's beauty, not its ugliness.

JavaScript is a combination of some really good and some really bad concepts. When writing in this language, be sure you know which is which.

Be familiar with this document before reading the JavaScript page.

JavaScript
Enhance.

Web crawling software and people whose browsers aren't configured to run JavaScript will not see anything from the use of this language. Use JavaScript only to enhance the appearance of the page. Do not use it to provide essential information.

(Note that for our current purposes we are dealing mostly with static web pages, not with interactive forms that are running programs to produce further results.)