Yep, I’m one of those people. Go ahead and judge me, but at least hear me out first.
Obviously, the first thing we have to do in order to answer the “Is HTML a programming language?” question is to define what a programming language is. Let’s literally take the term apart:
- programming: It’s when you tell a computer what to do. For example, I can program a bot to respond to messages while I’m away. Or I can program my phone to wake up at 7:30 in the morning. It’s all the same.
- language: A standard method of communication that is accepted by both the speaker and the receiver. Except in this context, it’s not with humans but a machine, so you’re not really speaking.
Following those definitions, a programming language must be a method of communicating to the computers what you want it to do. These are rather loose definitions that I came up with, but if you don’t agree with that, you can stop reading now.
The primary purpose of HTML is to serve as a method to display webpage data that is received from the server into a visual representation into your browser. That’s just a fancy way of saying “you tell the browser where to put stuff”. Let’s check if that satisfies the above points:
- You’re telling the computer how to display elements!
- You’re using a system of communication that both you and the computer understand.
If you don’t agree that the above two demonstrate that HTML satisfies the requirements for a programming language that I laid out above, then I’d love to hear your thoughts.
So why are people so insistent that HTML is not a programming language? Well, here’s some of the reasons I’ve seen so far.
- “You can’t perform arithmetic operations with HTML.” You can’t perform arithmetic operations with HTML because that’s not what it was made for. that’s like trying to use a hammer to screw in a screw. Doesn’t make it any less of a tool.
- “It can’t process data.” Refer to the first point about arithmetic operations.
- “It doesn’t
produce executable code.” Why not? Let’s say I put this line into an HTML file:
<br />
. Is it not telling the browser to create a line break? Isn’t that making it execute an instruction? Sure, you can say that the HTML isn’t actually creating the element, it’s the browser engine. But by that logic, no programming language actually exists other than the binary data that the machine is executing, since that’s what’s really executing all our code. If you don’t put the elements in, the browser won’t do anything, so HTML is giving the browser instructions on what to do. - “It’s not Turing-complete.” Where did the requirement that programming languages had to be Turing-complete come in? Just because your hammer isn’t a Swiss army knife that can do everything, doesn’t make it any less of a tool.
At the end of the day, this is all just still my opinion. If you don’t agree, please voice your opinions and convince me otherwise (preferably using well-informed arguments)!