| | | | | | | |

Bitesize Programming

With this post I am adding a whole new category to the website called “Bitesize!”  The target for this is New Programmers.  People who are so smart they have decided to learn computer programming and expectingly learn website design and coding.

As of this writing I have two students I am training in some capacity as a tutor.  These Bitesize modules are for them, but they would be useful for anyone new to programming. The goal is to write “well formed code” in HTML5 and CSS3, with PHP and JavaScript added.  With these tools you can make just about any website that exist today.

Polyglot Markup

Most of the best programmers subscribe to the concept of “Polyglot Markup.” That is, writing code that will function in many different hypertext standards.  Having been writing code for decades, I have written in HTML2, HTML3.2, HTML4.01, XHTML1.0, XHTML1.1, HTML5, XHTML5 and many other versions between these.  Many of my students are amazed to learn that most of my code blocks, written with a Polyglot Markup style, can be copy paste between these documents without modification.

Polyglot Markup is Easy

By learning to code using Polyglot Markup, you make coding a lot easier,  Just think, you learn one way to do things and you can write or modify code in many different types of hypertext.

Wikipedia states, “In order for an HTML5 document to meet these (polyglot) criteria, the two requirements are that it must have an HTML5 DOCTYPE, and be written in well-formed XHTML.  The same document can then be served as either HTML or XHTML, depending on browser support and MIME type.”

Basically, write HTML5 with XHTML5 syntax (coding rules).

Bitesize Polyglot

Throughout our Bitesize series we will be giving examples in Polyglot Markup.  You may find other tutors who give examples, usually in HTML4.01, HTML5, XHTML1.0 and XHTML1.1. These will work in their respective versions. However we avoid this type of coding as it just causes confusion and results in more errors and more debugging time wasted.

I use a slightly modified Polyglot Markup in that below the <HTML> element (tag) would be identical code in HTML5 and XHTML5 because I never publish XHTML5 to be ran under XML.

Time for a Break

For example:  The break element (tag) has been written as <br>, <br/> and <br />.  The Polyglot Markup (for HTML5 and XHTML5) is <br /> (six characters including the space before the closing slash). Now you do not need to worry about thr other two tags, just don’t use them.

It is difficult to read but you can view the W3C Polyglot Markup Document.

Now let’s look at a more practical example: Bitesize HTML5 – The W3C Validator

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *