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?

8 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.

  2. I always love seeing this discussion.

    Personally, I agree with you. It IS a programming language. And as you put it, a declarative one. There IS a vocabulary. There ARE grammatical rules and syntax. It DOES a specific task.

    All that being said, I don’t really care whether it really is or isn’t. But I think it’s kind of find to antagonize people about it sometimes. I might have to tackle this topic on my own blog sometime…

    Cheers, Mortoray!

  3. Hi, the creator of HTML described it as “an hypertext system for sharing documents” and that is exactly what it is, no ambiguity. On top of that:

    A static (pure HTML) file is not a computer program, is a document written using Markup Language. (h t M L). That document is the input for a computer program (the browsers) which renders a Web page on the screen (output).

    A language that is capable of instructing a computer to do things is not always a programing language. When I speak to my computer or phone assistant, I’m using Natural Language to instruct the computer.

    In summary:
    1. Markup Language and Natural Language are not Programming Languages.
    2. A programming language produces computer programs.
    3. Static HTML files are not computer programs.
    4. Static HTML files rendered on a browser are not computer programs either, they are the output of a computer program.

  4. I think we may want to look at an even “weaker” definition of programming that is weaker than the assumptions of Turing-completeness. Computer programs exist to assist people: computer programs mean nothing outside of the socio-cultural context, and also no one needs to be able to transcend the socio-cultural context with programs. There is no stepping outside of culture. Even further: programs are grounded, far now anyway, on Earth. But more important: *that* a computation has occurred involves the interaction of an observer, namely a conscious agent that can verify its result. In this sense, the instructions we give in HTML are for the purposes of allowing others to independently validate and verify a result. “Humans are the measure of all things” partly speaking, and this is the definition in which we may wish to think about “programs.” In this sense, a web page *is* a program: processing data independently of human perception or expectations is not even relevant. In a certain sense, by computational aesthetics, computation is about “determining indeterminacy”; so it might even be that a program minimally exists to afford the user *some kind of choice* in which the continuation of an experience is laid out or “arranged” (see definition of “programming”) through the use of a computer system or network. I might also even invoke the rule “if it looks like a duck”: a web page can be made to *look* like a program (family resemblance) and can facilitate control of data (humans are partly subsumed under the assumed data model the programmer has in mind) and events: forms have actions, inputs have toggles, etc., which can facilitate navigation and outputs based on instructions (imagine a tic-tac-toe game that consists of links for the board positions which link you to a new webpage that represents the state of the board; so if a player selects first-row-third-down, they are taken to a link that represents that state of the board, which is just a file, then the next player sees the new state and selects another cell — but the previous player’s cell is not coded as a link since it is a move that has already played, and so on). Why wouldn’t we call this a “program”? It involves instructions, the flow of “data” (or what is really “state”), satisfying the users’ expectations, etc.

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 )

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