DEV Community

Cover image for Why HTML is not a Programming Language?
Rishabh Singh ⚡
Rishabh Singh ⚡

Posted on

Why HTML is not a Programming Language?

If HTML was the first language you have learnt like me, then I am pretty sure that it must have been a little disappointing for you after realizing that HTML is not a programming language and is a markup language instead. This means that you cannot call yourself a programmer just by knowing HTML.

However, we hear this a lot but when we actually reach out to people to ask them what's the reason for HTML not being a programming language, most of the time probably will not have any answer.

Actually it's not that straightforward either but here are the top 7 reasons why developers call HTML a non-programming language:

😢 No Logic! No Fun!

One of the main reasons is that unlike other programming languages, HTML is incapable of logic building. That means it's very limited to just a bunch of tags. And you cannot do all sorts of cool things you do with your other programming languages.

😵 HTML can't make choices

HTML doesn't support conditional statements like if and else, which is one of the core features of probably all the programming languages I've ever known. It fails to compare values and make useful decisions out of it. I

😖 HTML can't reuse the code

HTML again fails to provide the facility for reusability of the code. Well, there are ways to apply CSS properties to multiple elements but as you see, it's CSS doing all the job not HTML so yeah not a programming language.

PS: CSS is not a programming language either.

😭 HTML is bad in maths

HTML cannot do any maths which is not a bad thing in my opinion because then you don't have to worry about losing your mind behind those nasty operators. However, this can be seen as a disadvantage as being able to do a bit of maths is essential for a programming language. HTML is a slowly evolving language so who knows we may get some ability to do maths within HTML in near future. But for now, HTML is only as good as I am when it comes to maths.

🤡 HTML can't modify your data

Without maths and external support from Javascript, HTML by itself cannot do any data manipulation. Even if it could there's no good way of displaying it. This is something we will take about next. However, for now, HTML is pretty much incapable of accessing and modifying the system memory content of the machine.

🥱 HTML can't deal with inputs and give output

Since HTML doesn't care about modifying our data, it is incapable of storing it either. It cannot accept any input except for the <input> tag but that doesn't matter as the data isn't stored anywhere. Same when it comes to giving output. Yeah I know it can display text on the screen but that's not the output we are talking about. The output should be something generated step by step by the language itself & its values should differ as per the input value. Which we know it's not the deal with HTML.

😱 HTML doesn't give any errors

This is probably something almost everyone hates & loves about HTML. Hates because it's so difficult to find the mistakes you have done into your hundreds of lines long code and loves because even if there's some mistake in a certain element, rest all the elements will be displayed on screen anyways. Now it's up to you to decide if you like this or not. However, giving reasonable errors is a good property of programming languages which we wish HTML also had.

So there we go here were the top 7 reasons HTML is not a programming language.

Discuss

  • What are your top reasons for not calling HTML a programming language?
  • Are there any other properties you know which add to point of HTML not being a programming language?

Let us all know your thoughts and opinions on this by posting in the discussions.

Let's Connect

Thank you so much for reading! I hope you fun reading and learnt something new today.

If you like my work please consider Buying me a Coffee so that I can bring more projects, more articles for you.

https://dev-to-uploads.s3.amazonaws.com/i/5irx7eny4412etlwnc64.png

Also if you have any questions or doubts feel free to contact me on Twitter, LinkedIn & GitHub. Or you can also post a comment/discussion & I will try my best to help you :D

Top comments (10)

Collapse
 
peerreynders profile image
peerreynders • Edited

This means that you cannot call yourself a programmer just by knowing HTML.

Merriam-Webster: programming:

the process of preparing an instructional program for a device (such as a computer)

Authoring HTML is preparing "instructions" in the form of markup to structure data which "programs" the browser to associate certain semantics with that data - affecting how it treats the data when it displays it to the end user.

However, giving reasonable errors is a good property of programming languages which we wish HTML also had.

HTML prioritizes end user experience over author experience - that is part of the web's resilience model - so if an HTML author can't be bothered to validate their HTML the browser doesn't punish the end user for the author's negligence - it produces a "best effort" result based on what it can work with. And anyone who chooses to validate their HTML automatically disqualifies tools that disregard the HTML standard like alpine.js with its x-attributes.

PS: CSS is not a programming language either.

MDN Web Docs Glossary:CSS:

A CSS rule is a set of properties associated with a selector.

Martin Fowler Bliki: RulesEngine:

A rules engine is all about providing an alternative computational model. Instead of the usual imperative model, which consists of commands in sequence with conditionals and loops ... rules, each of which has a condition and an action - simplistically you can think of it as a bunch of if-then statements.

i.e.:

  • Selector lists act as conditions.
  • Property lists act as actions.
  • Specificity and source order govern rule priority.

So in writing CSS you are composing rules for a domain specific rules engine which drives the visual design of the page.

People who author rules for Production Rules Engines are considered programmers. Now a CSS-engine is much more constrained than more general rules engines - but there is still the notion of "programming" by authoring rules.

So I think the core problem with the article is that it has a very narrow perspective of what programming actually is. It seems to be limited to using "instructions" to manipulate the "flow of control" (i.e. imperative programming) while completely ignoring "alternate computational models".

Maybe it's time to revisit what the term "programming" (and "programming language") actually means.

For example Simon Peyton Jones, one of the key personalities behind early Haskell published a paper in 2003 about Excel:

Improving the world’s most popular functional language - A User-Centred Approach to Functions in Excel

i.e. there is more to programming than "imperative programming" (e.g. declarative programming).

Quite often the HTML/CSS "is not a programming language" discussion is motivated by:

  • laziness: HTML/CSS isn't anything like JavaScript so I don't need to learn it or take it seriously - because I'm a "programmer".
  • gatekeeping: authoring HTML/CSS does not entitle you to the title of a "programmer" - you also need to author JavaScript (and lots of it).

It seems some "programmers" think that because authoring HTML/CSS doesn't yield to their "programming skills" they can judge those technologies as inferior to what they consider "programming".
So while they know that they find "their programming" easier (more familiar) than authoring HTML/CSS - they are secretly hoping that it works the other way around, that people skilled at authoring HTML/CSS will find "programming" difficult just because it is different.

Collapse
 
vonheikemen profile image
Heiker

This means that you cannot call yourself a programmer just by knowing HTML.

Please delete that part. It's totally okay to have an opinion on this topic, but this is unnecesary and rude.

And also, this would be a far more productive discussion if you explain what is a programming language in your opinion.

Collapse
 
stereobooster profile image
stereobooster

Yes! Provide definition of programming language, then depending on definition one can say if something is programming language or not. And no there is no single widely accepted definition dev.to/stereobooster/quiz-is-this-...

Collapse
 
madsstoumann profile image
Mads Stoumann • Edited

You do have simple logic in HTML. The <details>-tag has the open-attribute, which is Boolean. The # fragment identifier goes to specific location/s within a document. <input type="checkbox"> is Boolean (actually, it's tri-state if you include the initial state) - and <input type="radio"> can be if-else or switch, depending on how many of them you've grouped with the name-attribute. All of these are of course better, when enriched with CSS!

Collapse
 
eljayadobe profile image
Eljay-Adobe

HTML has three things: the DOM, the CSS, and the JavaScript.

The DOM part, as specified in the HTML markup language, is declarative.

The CSS part, as specified in the HTML style blocks or included CSS documents or even on a DOM element-by-element basis, is also declarative.

But the JavaScript part of HTML is very much a programming language. And given that it was originally designed to be tiny glue snippets of functionality to handle very simple events that could dynamically modify the (otherwise) static DOM, it is has demonstrated that it has the capability of handling very large and complex web applications.

From its humble roots as a twinkle in Brendan Eich's eye, it has grown and evolved to be a stalwart and ubiquitous web technology.

Back in the battle for the web, where Sun Java, Adobe-nee-Macromedia Flash, and Microsoft Silverlight were battling for the hearts-and-minds of web application development, I don't think anyone would have thought JavaScript would have won that war. But in the end, it turned out to be the little engine that could ... and it did.

Collapse
 
faranaiki profile image
Muhammad Faran Aiki

I agree that HTML is not a programming language, FAR from a programming language.
But, this reasoning is invalid, "HTML doesn't give any errors," it sure does not. But, that is irrelevant. You can make a programming language, compiler or interpreter,
that ignores warning or errors. Brainfuck is one of that, and pure opcode instruction ("binary" code) is one of that too.
And, "HTML can't deal with inputs and give output," there is a thing called "

Collapse
 
keskyle17 profile image
Chris Briggs

I come from the world of data networks, and I teach English, so two very different worlds where syntax, vocabulary and grammar are distinct but necessary requirements.

I configure routers and I write texts based on English, but I don't program them. However, I am the algorithm that figures out how they fit together. Cisco IOS has policy lists, and HTML has a media policy list of sorts, but neither are what I'd term programming.

I guess a Web Configurator would be the job title for someone with HTML/CSS skills, but in the end it's all semantics, quite literally. Otherwise, I could say if you code in Python or JavaScript, you're not a programmer, but merely a scriptwriter....

Collapse
 
acnerd profile image
Ashton Chamunorwa

How to be the best web dev ever

Collapse
 
mindninjax profile image
Rishabh Singh ⚡

Practice every day

Collapse
 
aatmaj profile image
Aatmaj

Coool post! Really brightened up with emogis😃