No, writing HTML is not programming. But watering your lawn is.
Jonathan Hall
Posted on February 21, 2022
Every once in a while someone will post a rant on social media about how writing HTML and CSS are just as much programming as Java or JavaScript. These rants seem to be fueled by a sense of righteous indignation against the concept of “gatekeeping” done by some self-proclaimed elites, who believe HTML is “beneath them” because it’s not “real programming.”
Invariably, someone else pipes in with “Yeah, and CSS+HTML is Turing complete!” I’ll address this distraction, too.
I believe this argument and entire line of reasining is misguided, and today I’ll explain why.
What is “programming” anyway?
Since this is a matter of definition, let’s start with a definition of “programming”. The relevant definition from Merriam Webster reads:
the process of preparing an instructional program for a device (such as a computer).
Okay. So what is an instructional program?
a sequence of coded instructions that can be inserted into a mechanism (such as a computer)
Continuing down the rabit hole, we find instruction:
a code that tells a computer to perform a particular operation
So this leaves us with the obvious question: Do HTML or CSS satisfy these definitions? Does writing HTML constitute “the process of preparing an instructional program?”
Before I directly address the question of “does HTML satisfy these definitions”, I want to take a small detour, and consider some things that obviously do and do not.
Things that definitely ARE programming
Building multi-player game in C++
Writing a bash script to deploy a microservice to AWS
Writing a mustache template to loop through the results read from a database, and display them on a web page
Recording a macro in Microsoft Word
Configuring a VCR or DVR to record a specific program
Setting up Zapier to post to LinkedIn every time you write an email
Configuring the angle at which your water sprinkler operates
Programmable devices, and thus “programming”, have existed for centuries, and include many mechanical devices such as looms, player pianos, and other musical instruments.
Things that definitely ARE NOT programming
- Writing a letter to your grandmother
- Cropping a photograph of your last holiday to the Grand Canyon in Photoshop
- Drawing sketch
- Dictating a letter to someone else who writes it
- Describing a criminal suspect to a sketch artist
- Typing
ls
at the bash command line to see a list of files
With these examples in mind, where can we go with HTML and CSS?
Well let’s start by throwing out the notion that “CSS+HTML is Turing complete” has any relevance. The first list is full of examples of true programming that have nothing to do with Turing completeness. The second list also has an examples of interacting with Turing-complete tools (bash, and people) to do NOT satisify the definition of programming.
“Yeah, but Rule 110 works in CSS…” Okay. You’re right. This means that it is possible to a form of programming with HTML and CSS. If you’re programming Rule 110 into HTML+CSS, or something else that encodes instructions into HTML/CSS, then yes, you can claim that you’re programming. But except as an accademic exercise, I’ve never heard of this being done. It certainly isn’t the normal use for HTML and CSS. The fact that you can arrange copper wires and silicon in such a way that they make a Turing complete machine doesn’t mean that everyone who uses copper wires is programming, either.
In summary: Programming is an activity, not a tool.
So does HTML or CSS involve writing programs?
I think it really boils down to the question of whether writing HTML counts as writing instructions. And I believe there is some room for interpretation here, but in my view: No, it does not.
A page of HTML is not a “program”. It’s rather a semantic description of some content to be rendered by a program such as a web browser. HTML does not contain instructions, except in the most abstract sense—in the same way one might say “the burglar has brown hair” might be considered an “instruction” to a sketch artist.
If we want to go that route, and claim that HTML is instructions, and therefore programming, then we must also admit that writing Markdown is programming. And then we must also admit that simply formatting a text document or creating ASCII art is programming.
#############################
## YAY FOR PROGRAMMING!! ##
#############################
___________________
| _______________ |
| |XXXXXXXXXXXXX| |
| |XXXXXXXXXXXXX| |
| |XXXXXXXXXXXXX| |
| |XXXXXXXXXXXXX| |
| |XXXXXXXXXXXXX| |
| _________________ |
_[_______]_
___[___________]___
| [_____] []|__
| [_____] []| \__
L ___________________J \ \___ \/
___________________ /\
/###################\ (__)
And from there we’re only a stone’s throw away from claiming that writing English prose with proper punctuation is programming. (“That period is an instruction to the reader to pause!")
Okay. So I don’t believe that writing HTML, or CSS counts as programming. However, this in now way diminishes their value or the effort that goes into using these languages.
HTML and CSS are limited in ways that many programming languages are not for the simple reason that they don’t allow programming. This actually makes them harder to use in many ways. Any experienced web developer has been tempted (and likely given in at times) to “just do it with JavaScript, because it’s easier”.
I have a lot more respect for someone who can write good HTML and CSS than someone who writes crappy “real programs” in Python.
So we need to end this gatekeeping idea once and for all. But we don’t have to change the definition of “programming” to do it.
HTML and CSS may not be programming languages. But “programming” is such a “low bar” (it’s been around since the 9th century!) that literally nobody should take this as an insult. But HTML and CSS are respectable for what they do. And I’ll be the first to jump to your defense if anyone ever says or implies to you “You only do HTML, so you’re beneath me!”
If you enjoyed this message, subscribe to The Daily Commit to get future messages to your inbox.
Posted on February 21, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.