Codementor Events

Of course HTML is a programming language

Published Feb 11, 2019
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?


Read my book What is Programming? and learn what it takes to be a great programmer. I look at the People, the reason software exists, the code at the heart of that software, and you, the person behind the keyboard.

Discover and read more posts from Edaqa Mortoray
get started
post commentsBe the first to share your opinion
leikein plekin
4 years ago

The programming structures are pretty awesome and I love this. Now one needs to be more clear about this. Now all walmart users can make use of walmartone portal to get all the benefits. https://walmartone.me/

Abdur-Rahmaan Janhangeer
5 years ago

you program the structure of the page

Show more replies