Editorial

Of course HTML is a programming language

Is HTML a programming language? I could express a bit of shock, even dismay, at the question, but instead, I’ll try a more polished approach. In some sense, it may be a legitimate question, in which case it deserves a fair answer. In another sense, it may be an attempt at gatekeeping. I suppose that also must be addressed.

My first concern is, what value would it be to say it isn’t a programming language? Does it bring us some clarity as to its purpose? Is there a doubt that HTML is used by programmers to create UIs? Is there doubt that HTML has source code? Do we doubt that HTML source code is subject to the same issue systems, requirements management, version control, peer review, and testing like any other source code? I’m not certain what clarity it would bring to say it isn’t a programming language.

However, before I conjecture on what else we could be asking, let’s take a more technical look.

HTML is a declarative programming language. Unlike an imperative programming language, which tells a computer how to do things, a declarative language tells the computer what the result should be. The engine that processes the code figures out a way to get the system in that state.

There are a lot of domain-specific declarative programming languages. Configuration files generally fall into this same category. The lists of options declare how you want a system configured. In DevOps, configuration is consistently referred to as code.

Occasionally we’ll see Turing completeness brought up in the discussion. Turing machines have been a wonderful tool in analyzing computation, and algorithms in general. They are used when talking about computability, whether we can find the answer to a problem. Though they can simulate a lot of languages and machines, they’re terrible models of real-world practical computing. They simulate, but can not model, many features we’d expect — including something basic like random access lists.

If we’re asking what a programming language is, I think we need to stay at the practical level. Let’s leave Turing completeness to the theory. A proper discussion in that realm requires going into a lot more detail. I’m not dismissing it. I find it fascinating, but not relevant to our question.

What might be a practical definition? How about a programming language is a set of codes that unambiguously instructs a computer as to what it should do. HTML instructs the computer how to create a visual document, or app interface, for the user. Python, Java, or C++ give sequences of commands that tell the computer how to manipulate memory, modify files and talk on the network. Haskel, or O’Caml create structures of equations that calculate results.

I might need to be careful with that “unambiguous” bit, as many languages have dark corners to them: unintentional defects in the language, intentionally unspecified behaviour, and the outright nasty undefined behaviours. So, we’ll have to live with for-the-most-part unambiguous.

Different languages instruct the computer differently. We recognize they aren’t all appropriate for every situation. There is no all-domain all-purpose language anymore.

Back to the question then, what value does it bring to say HTML isn’t a programming language? I fear the answer is related to gatekeeping. Some individuals feel a need to distinguish the quality of programmers based on some artificial goal posts. It helps keep the role of programmer artificially elite — for some definition of elite.

It’s not like the label “programmer” magically makes one qualified to do all types of programming. It’s a large field. We have lots of tools and lots of approaches. Somebody who knows only HTML won’t likely be hired to program a game engine or embedded sensor. Nor would a data analyst specializing in NumPy be a good fit for a mobile interface.

But even still, who only knows HTML? Perhaps we’re talking about UI/UX designers that use it to create prototypes. These are people that will work with a programmer to help them get what they want. I don’t think they’re clamouring to be recognized as programmers themselves? I do consider them developers though; I have a chapter in my book about why I think this is important.

Otherwise, most of the web programmers I’ve met doing HTML seem also to be doing CSS and JavaScript. It’s difficult to program an interface using only HTML; it’s inevitably combined with other technology. It needn’t be, but that’s the most common situation. If somebody wishes to deny JavaScript as a programming language, well, let’s just ignore that foolishness.

In summary, HTML is a declarative programming language. It can’t do everything, but no language can. There’s no practical value in saying it isn’t a programming language. Though a programmer who knows only one language is limited in what they can do, this applies to all languages, including JavaScript, C#, Python, or whatever. We could argue that this theoretical person who knows only HTML is not a well-rounded programmer, but not that they aren’t a programmer at all. Instead of trying to exclude them, why not work with them, and encourage them to learn all the other beautiful things that can be done?

2 replies »

  1. Pretty much hard disagree. It’s not about gatekeeping, it’s about the ability to do anything resembling logic with it. A programming language is something that you can use to perform computation; HTML can only specify a display and cannot be used as, well, a computer. The same logic that would make HTML a language would also make, say, SVG or any file format a language, which seems to me obviously wrong.

    • Why would you choose computation as the bases for what defines a programming language? Why would we not go with a language that is capable of programming the computer — instructing it to do things.

      Even if we go with computation, why can’t I argue that the result of an HTML file is computation. Together, with the VM, the browser, it must compute layout.

      If you disallow that, then a function like `open` isn’t a programming function, since it doesn’t compute anything. It merely opens a file.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s