Of course HTML is a programming language

edA‑qa mort‑ora‑y on February 11, 2019

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... [Read Full]
markdown guide
 

"what value would it be to say it isn't a programming language"

What value would it be to say it is one?

Some people feel better when they say HTML isn't a programming language because they think they are now better than people who only know HTML.

Some people feel better when they say HTML is a programming language because they now think they're on a level with people who know other languages.

Both don't add anything meaningful to the discussion.

 

Quite correct.

I think the only meaningul distinction is between a general purpose programming language, and a domain-specific programming language.

It seems to me that HTML is the latter.

Qualifying it as a "true" or "false" programming language (or Scotsman, wink wink) doesn't really matter, however I do think qualifying it as a DSL does add meaning.

 

You could say the same about any categorisation. There is a reason why you are a human, a mammal, an animal, a life form. Those might seem unnecessary labels but they tell us what you do, what you are capable of. Same with languages.

Indeed.
There is a point at which all meaning is lost in detail, and that is in general, not where you want to be. Hence my approach to try and find a lowest common denominator that lessens my own cognitive load.

 

Sure, but seems like semantics to me.

Is it a markup language or a domain-specific language?

Isn't a markup language a domain-specific language?

In my opinion, semantics matter. Granted, only up to a point, but I personally draw my own line there. DSL is good enough for me, that's all I'm really saying, I'm not trying to solve a metaphysical issue.

 

No: HTML is not a programming language.

Also No: this doesn't mean it's any less valuable of a skill.

Also not programming languages: xml, yaml, json, markdown. They don't need to be called programming languages to be considered valuable skills.

Saying HTML is not a programming language while JavaScript is, makes no comparison between the 2 languages at all. It is indicative of each language's abilities and uses.

 

HTML - some text which makes computer do something e.g. display a form or a text etc. How that is not a programming language?

Here is good paper on PL classification if you have any further doubts

 

HTML does not make, or instruct, the computer to do anything.

<title>Page</title>

The above HTML snippet could be viewed as a key/value pair. The key being title and value being Page. There is no instruction to store, display, or interpret this value.

Another way to view it is that there is one piece of information "Page", which has markup code wrapped around it to define what type of data it is, "title". In being a markup language HTML essentially defines meta-data.

HTML has no instructions, it cannot actively do anything or instruct a computer to do anything.

Again, this does not make it any less or more in status than a programming language. A markup language just isn't a programming language; and that's OK.

I think the distinction between markup and program/logic code is important, it's a matter of accuracy and managing expectations.

You saying "instruct" as if alert('Hey') (or any other JS function) have some magic powers to actually instruct computer. No it doesn't. Browser reads it, converts to instruction set, sends it processor (or GPU or...) and eventually machine executes it.

What happens with HTML? Browser reads it, converts it to instruction and send it to machine, which executes it.

That sounds like over-simplyfication to me.
You could also say that about writing into Word document. Word have to do the same to be able to display formatted document, but it doesn't make Word a programming language.

 

HTML is a declarative programming language.

Haha no.

There is not such as declarative programming language.

A programming language must fulfill at least the next 3 points:

  • It must be able to do a function or operation. (call)
  • It must be able to do a logic (if).
  • And it must be able to change the flow of the execution (goto).

And HTML lacks of all of them.

And about CSS and javascript, they work in tandem (trio) but they aren't HTML.

However, I agree, HTML is highly important. Important = yes, language = no.

 

Where'd you get those rules though? I don't agree with them, personally. I'd rather use a definition more like, "A programming language is any human-readable language that allows a writer (i.e. programmer) to unambiguously instruct the computer to perform a desired set of actions". HTML certainly falls into that definition.

And anyway, while HTML on its own may not fit your above three rules, I'd argue that the HTML+CSS combination does.

  • Function calls - It's been argued before that HTML tags and CSS rules could both be considered function calls, as they both instruct the computer to execute some previously defined code.
  • Logic - CSS has various conditional operators, e.g. @media queries, :nth-child() selectors, etc.
  • Change the flow of execution - This is more questionable, but similar to the previous point, I'd argue that @-rules like @media queries "change the flow of execution" in that they produce a different set of CSS rules, which changes the flow of the rendering pipeline.

To be honest, these rules are pretty questionable even outside of this discussion, especially the goto rule. There's no native goto in many classic languages, e.g. JavaScript, Haskell, Prolog, and many Schemes. If you didn't mean a literal goto, but rather anything that allows moving to another bit of code at will, then how does this differ from the function call rule?

 

I'm not fully agree with the idea. HTML is a markup language, it contains no programming logic and is not Turing complete.
We must distinguish between languages, otherwise will be a general confusion and someone can consider any language as a general purpose programming languages.

 

This is sort of beside the point of the article, but I think another interesting approach to take on this age-old topic is to consider HTML+CSS together as a programming language instead of just HTML by itself. CSS layers on top of HTML, and it introduces a lot of constructs that could be considered logical statements and execution-flow-controls, e.g. @ rules and :nth-child() selectors.

 

I definitely agree with you here. Prior to reading this article, I have always seen HTML as strictly a markup language that defines the structure of a document. Indeed, it is "just a markup language", but combined with other technologies such as CSS, JavaScript, and a proper browser (with an HTML parser), it is capable of so much more than "just being a markup language". In a way, it is the ultimate programming language of UI.

Thank you for this article. It definitely gave me a whole new perspective on this "debate".

 

Great post. I would call HTML a programming language. It is a simpler one than others, but is a programming language nonetheless. I think the best thing you bring up is the gatekeeping that is so very prevalent in the Developer community. There is a large number of folks who seem so intent on keeping what they do as magical and as mystical as possible in some weird process of keeping their value at the thing they do. But, instead what we should be doing is bringing in everyone who wants to be here. There is so much variety to what code and programming can do that there is room for everyone who wants to learn at all levels. Our value comes from what we can teach others and helping them find ways to express their ideas, not from keeping secrets about our magical processes.

 

I would consider computation, i.e. transformation of data, as the essence of of a programming language. And the only form of computation, if you will, that HTML is capabale of, is producing constant functions, which, given arbitrary input, will yield a static data structure - albeit one that can certainly be quite complex and very useful.

That being said, that a formal language doesn't constitute a programming language, diminishes its value and importance in absolutely no way. A software system consists of many different artifacts, of which HTML often is an one. And by the way, I also count requirement specifications and user documentation to artifacts that are vital part of a software system. And those are both, at least in most cases, artifacts that, in contrast to HTML, neither follow a formal grammar nor are executable. Computational capabilities the only property that makes something a useful or important.

To conclude, although I disagreeing with the proposed definition for programming language, which is premise of your argument, I indeed very much appreciate the articles sentiment of speaking out against gatekeeping in software development, which in the process of creating a working system isn't useful at all.

 
code of conduct - report abuse