In this episode of Webbed Briefs, I shall be asking the question, “Is HTML A Programming Language?” And—spoiler alert—I shall be answering that question, quite emphatically, with this word: “Yes” , which is the standard British English term for “Yes” .
That’s the easy part out of the way. Now let’s examine some of the objections to the unequivocally true statement, “HTML is a programming language” .
(1) “You can't write a program with HTML”
What is programming? Programming is giving computers instructions. It’s telling them what to do. Programming languages are grammars understood by and intended for computers.
With that in mind, your first clue that HTML is a programming language is that you don't see HTML tags on a rendered web page. That's because they are not intended to be seen and read directly by human visitors to that page.
Your second clue that HTML has gone and done some ruddy programming all up in your computer is the graphical topography of the web page you are looking at. Without HTML instructing the computer to structure and format it according to the HTML author’s instructions, it would look something like this.
(2) “HTML is not Turing complete”
Neither are the languages SQL, Sequel, or Skwool.
Turing completeness is one way of measuring the capacity of general purpose programming languages, not a test for programming per se .
HTML is a domain specific programming language, not designed for anything but rendering web documents: a singular but important purpose. I feel like this is a fairly simple diagram to understand. So this shouldn’t give you much trouble either. Or this.
(3) “HTML isn’t a programming language, it’s a markup language”
Sure, and this isn’t a quadruped, it’s a horse. A markup language is not a natural language; it has strict syntactical rules intended to be understood by computers. And the only reason we want computers to understand those rules is in order to tell the computer what to do AKA programming.
What you really mean when you say “HTML isn’t programming” is “HTML isn’t the kind of complex or impressive programming I—a person desperate to make claims of intelligence—could possibly lower myself to be associated with.” Which is all the more embarrassing for you when the HTML you do end up writing sucks so much ass.
(4) “You can tell HTML isn’t programming because it doesn’t have if
statements”
First of all, yes it f**king does. But also: do you see any if
statements on this, a punch card? Even one? No you can’t. And if punch cards “aren’t programming” then we’re missing a rather important antecedent to the programming that does fit your wild preconceptions.
Also, what the f**k is this expression? No if
statements here, can’t be programming then.
Instead of getting hung up on specific language features and formats, a much simpler way of determine whether some text is programming or not is to try and use it to tell a human being to do something.
Director’s note: Forgiveness
And don't be fooled by HTML pages still rendering when you write broken markup. That’s because it is a forgiving language—or rather, the browsers that render it are forgiving—not that it isn’t a programming language at all.
If you don’t believe HTML is a programming language because it is declarative and you simultaneously believe procedural JavaScript is improved by adopting a more declarative style, you may have brain worms.
Director’s note: Objection: HTML doesn’t even compile
Python, JavaScript, PHP, Perl, Ruby, and BASIC do not need to be compiled either. People are obsessed with making JavaScript into a compiled language but that’s another matter for another day.
(7) “HTML doesn't do anything on its own, it needs a browser to work”
We’ve only just met, and this is crazy, but all programming needs something to program and an environment in which to perform that activity. Unless your intention is to, let’s say, sell the text representing an unexecuted program as an NFT, your program has no value in and of itself. NFTs don’t actually have anything but a purely transactional value anyway, but that’s beside the point.
Director’s note: Why Does It Matter If HTML is a Programming Language or Not?
If you expect HTML to manifest some sort of intrinsic worth like a rare mineral while accepting that other languages require runtime environments, that tells me you are applying more emotion than logic to the subject of whether HTML is or is not a programming language.
(It is one.)
(8) “If HTML is a programming language, then a Word document is a programming language”
A Word document is not a language at all, you absolute f**khead. You are reaching so hard to support your parochial views on programming, you’ve conflated markup with the graphical user interface of a proprietary desktop publishing application.
Director’s note: Why Does It Matter If HTML is a Programming Language or Not?
Well, programming is a relatively well paid occupation, largely because we consider it a difficult thing to do well. Even though, say, nursing or retail are probably a lot harder on a number of levels.
By othering HTML (and related languages like CSS) as just code and not really programming , the implication is that they do not deserve the same care and attention as other languages.
This can lead to a couple of unfortunate outcomes:
People who specialize in HTML and CSS are not valued or paid as well as they deserve to be, or
People who do so-called “real programming” are given the responsibility over a language they have no respect for because “anyone fucker can write this shit”
Skilled professionals go underpaid or can’t find work and the web itself becomes stuffed with hideous “div buttons”: keyboard and screen reader inaccessible faux button elements.
In summary:
HTML is a declarative language
HTML is a domain specific language
HTML is a markup language
HTML is a Turing incomplete language
HTML is not a natural language
HTML is a programming language
And so is CSS