To some people, all a language has to do to be a programming language is tell a computer to do something, that’s it! They may be right and for that reason, HTML can easily be mistaken for a programming language. Think about it… HTML explicitly tells a computer how to display a web page – a programming language telling a computer what to do, right? Disregard the web browser or the internet as you think about HTML. This can lead to a bit of confusion and that, that is what this article purges. HTML demystified.
To understand a programming language, one has to start with its definition. There are many variations of definitions but for this article, I shall stick with a very simple one. A programming language is a set of grammatical rules and vocabulary that instruct a computer (a computing device) to perform a specific task. I know it sounds simple but let us get right into it and discover what it really is.
The first question that needs answering is this; “What is HTML?”
HTML stands for HyperText Markup Language. By definition; it is a markup language that encapsulates data within angle bracket tags that have defined meaning thereby instructing a web browser how to display textual content. I have used that long definition so that each part of it is totally understood. In that definition, something comes up – markup language. A Markup Language is a system of annotating a document in a way that is syntactically distinguishable from text. It is important to note that ultimately, all computing is text processing.
The second question that needs answering is this; “How is HTML structured”
Every website is a combination of HTML documents. When I refer to a document, I mean the normal document – for example a Microsoft Word document but with distinct differences. An HTML document is saved with a .html file extension and is quite different from the other documents that you have hanging around in your computer. It starts off with the definition of standards, then head tags and body tags groupings. Inside each of the tag groupings, there are a bunch of many applicable tags. An HTML tag is element names surrounded by angle brackets. Let us see an example to understand:
<title>This a Title</title>
<p>This is a paragraph</p>
Text in bold represents HTML tags and you can clearly see they are in pairs. An opening tag and a closing tag. This example is an oversimplified web page but, it’ll do for now.
The DOCTYPE declaration at the start of our HTML document example is
used to define standards to use to process the markup contained within
the such a document. The information within the <head></head> tag is metadata that is never visually displayed (with the exception of the <title> tag) and gives that browser, web applications and search engines some very important instructions. The next section is the <body> tag that contains all the information intended to be seen by a web user – it is visually interactive.
When a user requests for a web page (HTML document), the browser reads (parses) the information in the following order: <Doctype>, <html><head>and all tags within</head> <body>and all tags within</body><html> and returns formatted information to the user. This happens at very fast speeds so you barely notice what happens in the background.
Third and final question: “What enables HTML to work?”
For HTML to work, you need to have an application (computer program) called a web browser. A web browser is a computer program that has the prime purpose of presenting a web resource you request from a server by displaying it on a browser window. But that is not all. A web browser has some tricks up its sleeve that you never notice as it works in the background. What you see when you visit a website is a product of a series of steps. To learn, continue reading.
Let us assume you visit this website: www.clytech.co.ke what happens?
The browser parses the contents of the HTML document thus rendering the page on the screen according to a tree structure acquired from the HTML document, then you see the page on the screen. You can read the whole process of how a browser works here.
What you can see is that at no time do we have the html document communicating with the computer. What communicates with the computer is the web browser and it does so covertly so that you never get to endure the long process. This, and the fact that HTML does not meet the bare minimum required for a computer programming language properly disqualifies it from that category. HTML is used for structural purposes only, not instructions directing what a computer is to do, there are no algorithms. It also contains no programming logic, can’t evaluate mathematics, does not carry out any tasks, you cannot declare any variables with it and it cannot even take an input.
Next time someone asks you what you favorite programming language is, DON’T say HTML for heavens sake! Now you are educated.