Radio Inspire

How To Learn Sign Language

HTML IS a Programming Language (Imperative vs Declarative) – Computerphile

I’ve been in a recent set of videos that
we’ve done, related to HTML, I really have taken a
severe beating in the latest one that I’m a disgrace to Full Professors as I
don’t know what a programming language is and how it differs from a markup
language. And my attitude is going to be: “Well I stand by what I say”. HTML is a very restricted form of
programming language, in my view, so we need to justify that. And I need to say at the outset that you
don’t need to see all the previous HTML videos in order to understand this one,
because it really comes down to something that’s actually very
fundamental. In the end it comes down to two different styles of programming
language that are interrelated that you can differentiate, in a way, between them.
And when does one merge into the other? And these two ways of doing programming are
known in the trade, generically, as either the imperative style or the dclarative. Now the one that most of you will be the
more familiar with is the imperative so we’ll do that first. This is really just programming as you
and I understand it you take your language of your choice Assembler, Java, C, Basic, whatever and
you are required to give a detailed specification of how you are going to do
this problem. And, as we know, this detailed specification might be simple
arithmetic programming statements; it might require going round things in
loops; it would certainly require taking
decisions. So it will have ‘if’ statements inside it. So, if you like, ordinary straightforward
detailed nuts-and-bolts programming is in an imperative style, because you
have to say how you are going to solve the problem. I’ll put “How” in quotes here
saying that leads you to ‘if’, ‘for’, arithmetic statements, whatever you need.>>SEAN: So this is setting out how you are going to
do something. If this button is pressed then do this?>>DFB: Yes! Yes! And the vast majority of
programs that most people think of, in terms of programming, are done in this style. Now what about declarative then? Well
‘declarative’ – it’s a more functional style of programming, where the interpreter for
your language does the details and actually one style can merge into another
And I’ve got a very good example of my own and we’ve done it on Computerphile.
I wrote a program to do the Ackermann function. I think it’s my biggest hit so
far – that particular video. And within the function ‘ackermann’ we saw program
statements, we saw use of recursion, we saw ‘ackermann’ calling ‘ackermann’ and
all this kind of stuff. And finally returning and delivering back an answer. However, back in the main program where I
call up ‘ackermann’ with certain arguments and I call up the
‘ackermann function’ as the arguments …. I don’t worry about the
implementation details of ‘ackermann’ I just call it up – at the end of a big
printf statement as i recall. I say declaratively “Give me ‘ackermann’ – do it for me! I forgot the details of how
I did it”. Many of you know this. The whole idea of writing your own library full of
functions for a particular job is that you can then work more abstractly. and
at a higher level. You can say “I wrote those 20 years ago. I’ve forgotten how I did them.
But it doesn’t matter. Do me ‘ackermann’ with parameters “thing” and “thing” — something like that. So you see the one can merge into the
other as you take a more functional approach. You could argue, loosely, every
time you use a library of functions that you bought in from somewhere then you
are becoming more declarative in the way that you use it. So the point about declarative is you
don’t have to go into the nuts and bolts details. You just ask for what you want
and magically it happens. Typical examples of real declarative
languages are things like Haskell. what are the trade-offs about this? Well,
you could probably say that most of these declarative languages don’t work on the bare metal, like your
C program could do eventually. They are interpreted, with a layer of software
between you and the bare metal. Now that gives you flexibility because the
Haskell interpreter can be basically ported to all sorts of architectures.
Somebody’s got to do the hard work but then you know that if you take the Haskell
program along you can just run it. You don’t have to
convert it into a binary. It just runs on the interpretive mode. So it’s trade-offs
And other things being equal (it’s less true now it used to be) you lose a little
bit of efficiency in an interpreter whereas, y’ know, if you refine
a thing right down to a hard-core binary it’ll go off like a Maserati, we hope. And some languages, as we know,
have a compromise here. Java started life as being a portable interpreted system
but with a syntax that’s really pretty much like C. But it’s notable that now, when
you’ve developed from the Java, there’s very often an option to say ‘If you want to
compile this and make a real executable binary of it yes, you can do that’. But during
development you get a lot of flexibility by just being able to do things and try
them out instantly . That then, I hope, has given you a bit more insight into what
the imperative vs. the declarative approach is. And that’s very relevant to
discussions of whether HTML is, or is not, a programming language. We all know

give me a heading, level one. Now, of course, I have to show where the
stuff that is your heading – the text – ends. But to me you can say “Look, I’m
calling up the function

, I’m giving it the argument ‘this is my heading’ to be done in h1
style”. And

is really just to say, “Oh! by the way, there’s no other
way I can signify where my text string ends, It’s not semicolon or anything like that”. Conventionally its

. So to me, yes, you can think of that as being a
function call in a way. However, some of you really did hit home
a bit more accurately, I think, when you said “It can’t be a programming language, really, because it’s not Turing Complete. Now that is a topic – I’m sorry I hate
doing cliffhangers, you know I do! – that’s a topic that we have mentioned
from time to time but it’s big enough that we need to do a separate video,
really, on that, It’s perfectly correct that HTML could never be thought of as a
full-blown programming language. It can’t do ‘if’ statements in its raw
vanilla form! There’s no way inside HTML that you
can say “Give me a megabyte more space to work with”. It’s just not part of the language. Somebody has pointed out, I think, that
HTML with CSS does become a very powerful Turing-Complete language but
you wouldn’t want to use it. It’s not general purpose – that’s another
thing. It’s really is a question of “Is it imperative; is it declarative?” This is
declarative but is it general purpose? No, this is really for programming Web pages. That’s the way I think of it and also,
like I say, it’s not Turing Complete, but you can certainly argue that anything
that takes tags as if they were function calls and interprets them and does them for
you is, in some restricted sense, in my view anyway, a programming language.

100 Replies to “HTML IS a Programming Language (Imperative vs Declarative) – Computerphile”

  • You're always going to have problems classifying languages so long as you treat "markup languages" and "programming languages" as two wholly binary categories with no overlap. Where do you put TeX?

  • I'm surprised the professor didn't mention JSX which would have been a very good way of showing how something like HTML could be described as a declarative programming language. JSX is actually compiled into pure JS function calls so having that explicit intermediate step to point to would have been a good example, I think.

  • Another vote for what seems obvious… HTML is not Turing Complete, so HTML is not a programming language. No variables, no selection, no iteration or recursion. NOT a programming language. It is a COMPUTER language, but that's a more general class.

  • sorry, I still am not convinced HTML is a programming language.
    for the moment at least its still going to be a mere formatting or markup language for me.

  • I… I don't know what a programming language is now. It doesn't have to be turning complete, it does have to be turning complete, it needs to do 2 + 2 or it needs to be compiled vs interpreted.

    I feel sad.

  • Searching for "programming language" google gives me : "[…] Programming languages can be used to create programs […]" HTML describes how data is organised within a document. (what's the title, what's the text of first paragraph, etc). Feeding (only) HTML code into a HTML "interpreter" (e.g. a browser) will always cause it to do the same thing: parse the HTML and display it on screen. No mater what data we put in there, it will do always the same thing. Unless an actual programming language (like JavaScript) is enabled, the behaviour of the browser will always be the same. There's a very clear difference between a program (code) and data. I don't get why people still discuss wether HTML is a programming language or not. Language? Yes. Programming language? No. It describes data, not calculations. Declarative? Yes, of course, it describes data, how could it not be declarative. But declarative programming language? No. In Prolog you declare predicates, that's a declarative programming language. But even there, you have to provide implementation details (the "how" part).

  • html is like a savefile form a game …..
    the boswer is loadoing it and as it is not much happens …
    the DomDocument in the browser youst reading the html file making it into domdocukment . and you can style it whit css and munipulate it whit JavaScript
    for me HTML is not a programing language . its youst a way to markup the domdocument
    programing is for me is whit ifstatments while do foreach etc that skip some stuf if that and do again if that and variabels and more …

  • Imo for the word programming language to have any meaning, its definition must include turing completeness, which is not given for HTML. Ergo not a programming language.

  • Ah, programming languages. Well, the first programmable device we know of was created about a thousand years, so programming isn't restricted to just computers. A program is just a sequenced set of instructions and a language is a structured way to convey information. Based on these, it could be argued that any method of communication where a human being can provide such instructions to a constructed medium, and these instructions can be executed by said medium, is a form of programming language.

    And yes, I do know the theory of how HTML is "just a mark-up language", as per it's name and application. But here's the thing: just because computer scientists tends to define things based on their practical applications, doesn't mean those conventions are entirely accurate. Even in human languages, we still have words and phrases that aren't actually matching what they describe (or in some cases directly contradict their obvious meaning), but are still considered valid in relation to their intended purpose.

    Personally, I don't consider myself to be on either side of this argument, and I don't mind what people define HTML as. Regardles of whether they refer to it as a mark-up language or a programming language, it is still a language that provides instructions to be carried out to a computer, just as any low-level language does, though just with a more limited vocabulary and syntax.

  • Keep it up, love your videos, in fact I search for them amongst the other Computerphile ones. OK HTML without CSS or Javascript isn't a complete language, but even taken on its own, by the time it is interpreted by (whatever browser you use) it is so close as so be indistiguishable. … @aka 47 Microsoft Word is not a programming language on its own but I have used macros in Word to do things which would be considered programming. And there is always the horrible WordBasic!

  • What relevance has it if html is a programming language or not? It does what it should do, some things it shouldn't, but whether you call it a p.l. is irrelevant, isn't it? I mean, it doesn't change anything.

  • So the Windows Command Prompt is a programming language? I can type "notepad" and hit Enter and I've written a simple word processor. 😉

  • If anyone doubts what this guy has to say, you may want to look in the mirror and ask yourself if you are not the problem. This is one of the smartest, down to earth men in the business, and if he says something and you don't agree…you had better bring it on, cause you know his game is strong.

  • Really? All those people freaking out about the fact that he equated
    HTML with C, but not a single mention of the really important thing
    about that video: He said "Do a P" at least two times.

  • One of the requirements of a programming language I have is that it has to be Turning complete. HTML is not Turning complete.

  • If a job applicant claimed html is a programing language we would chuck out his application as someone who doesn't know wth he's talking about, I.e. a chancer.

  • Doesn't have variables, doesn't have conditionals, doesn't have flow control, and to top it off, it can't do any computation of any kind. If HTML is a programing language, than so is SVG.

  • Had this argument again recently, and before I watch video, I see it as this… call browser system A send system A instructions get output.. done.

  • To the people saying you have to be able to, say, implement a FizzBuzz in HTML for it to count, remember that a FizzBuzz is just a program that outputs a particular sequence of lines. There no requirement that it uses loops or checks at all you could just write it out in HTML.

  • It's really ridiculous how people are telling a computer professor who has worked since the beginning of computing that he doesn't know what a programming language is.

    A program is a set of instructions. HTML is a set of instructions. So an HTML file is a program. And HTML is a computer language. It is a way for people to communicate with a computer. So HTML is a programming language.

    Pure binary code is not a language, but they are programs. Go look at fonts–they are protected as programs. The language is usually compiled, however.

  • oh, the idiotic braying plebs making garbage arguments against the video. bleating cliches and parroting crappy reasoning. what a comedy.

  • It is worth of noticing that html is not only 'h1' and 'p' tags. There are also forms with which you can read file and send to server. But for me it's still not enough for calling html programming language, because browser make all this work. Although there are some html preprocessors that flavor html as programming language.

  • If you input something and the computer outputs something based on your input, then the instruction you gave the computer is "programming".

  • HTML is derived from IBM’s mainframe word processor which was called HTML. It is from, at least, the early 70’s. We used it heavily for writing our systems and projects documents in our computer department.

    We created text files with the various control commands for paragraphs, ordered and unordered lists, footnote references, etc. We’d then type a command that included the text file name and that produced the formatted output to the printers.

    Early non graphic personal computer word processors were similar. Text with imbedded formatting commands. Word Perfect for example.

    Buried in the basement someplace is my HTML reference guide from IBM with a copyright of about 1972. HTML has had a couple tweaks and additions over the years.

  • HTML is data, not a program. No different than json, csv, or even txt.
    Is a txt file containing an English paragraph a programming language? It contains ASCII codes, not actual English letters, it's interpreted by notepad to display an English paragraph. No one will say English is a programming language. There is no conceptual difference between that and html being interpreted by a browser.

  • HTML is a programming language because it tells the browser how to render a piece of text. XML or JSON is not unless you use them with an interpreter that performs actions based on the content. In the case of HTML this interpreter is implicitly known to be the web browser, hence a programming language.
    I realize this seems like a weak definition of programming language, but consider this: Truetype Fonts are data files telling a font rendering routine how to draw each letter in terms of lines and arcs. This is quite similar to the function of HTML. Are Truetype fonts programs or not? The answer is yes: In fact Truetype fonts can by law be copyrighted as such and in fact some are. This is the reason why Apple has Helvetica and Microsoft has Arial, they look almost the same but not quite, due to copyrights issues.

  • It's two perspectives clashing here. The people who say HTML is not a programming language, because it doesn't have certain properties to earn that name are correct. The other way of looking at it is asking these questions: 1) Does writing HTML foster your programming skills? 2) Does experience in programming alleviate writing HTML?
    The answer to both questions is undoubtedly yes. The mindset, ability to instruct a computer with proper syntax and, for example, nested blocks of instructions, is exactly the same.

  • Do you think the lovely people at computerphile could do an episode on all the programming paradigms? I find it all confusing 🙂 thank you!

  • This video was uploaded two years ago . . . well after HTML had, innately, integrated PHP (full-fledged server-side programming language), javascript (client-side scripting language), and CSS. These can all be used without leaving that HTML document. It makes me wonder if you guys have ever programmed with it.

  • I think this is just semantics, but I do think that HTML isn’t really a programming language in the traditional sense. Arguably it is in an abstract sense, but certainly not in the classical definition. I think of a programming language as more of something that can calculate things, with Turing Completeness being the biggest factor.

    You do have a point that it could be considered an “incomplete” programming language as a result, which is probably the best definition.

  • I enjoyed this video quite a lot, it filled in a bunch of knowledge gaps I didn't know I had. I don't care if markup is pl, bit the declarative vs imperative stuff is super helpful. I like to write libraries for myself to abstract my work for other's benefit, and I don't like XML for Android layout because it isn't quite as live as html coupled with js. I don't like java's seeing because it's on the other side of the fence. Now I know why.

  • I've been saying this all my life, and I'll say it again, loud and proud:
    HTML is a programming language, no doubt, let the geek mob rage.

  • I don't consider HTML to be a programming language, but to each their own. It doesn't matter at the end of the day.

  • Comments about Turing completeness always crack me up. Stop throwing around terms you have no idea what they mean or imply. Making a PL Turing complete is a joke. Non Turing complete languages are used and are useful in various situations. So Turing completeness is irrelevant to the question; You don't sound smart throwing it around, but ignorant.

  • in my personal opinion, HTML and all web development IS programming in a sense, but very locked down and the highest level you can go.

  • Talk about grasping at straws with a straw man argument… The creator wouldn't have called it MARKUP if it was PROGRAMMING. Just because an "interpreter" can transform a PNG file into an image on the monitor doesn't turn PNG into a "Programming Image"… If it could do even the most basic of programming tasks, nobody would have bothered with JS. Data is data is data.

  • So, i think to believe that we need <for>0<to>10<do><p>Hello!</p></for> and <if>0<do>hello<else><if>1<do>olleh</if></if> in HTML.

  • He explained this very well. HTML is a programming language, it does not tell the computer HOW to make a page, but WHAT the page is.

  • 1:07 It used to be “procedural” versus “functional”. Until the OO folks hijacked “procedural” to try to mean something different — not realizing that most OO languages are in fact “procedural”.

  • 1:55 What constitutes “detailed nuts and bolts” seems to vary over time, though. When higher-level languages were first invented, to take away the requirement to write in assembler, they were referred to as “automatic programming”, since the “program” was considered to be the actual executable machine code, the source code being a kind of “specification” of how to generate that.

    HTML still requires you to worry about the “detailed nuts and bolts” of setting up a form and defining its fields and their CSS properties, for example. If you want to go higher level than that, you resort to something like JQuery.

  • Who says that the programming language must contain conditional statements or be Turning Complete?
    Because Britannica says: "Computer programming language, any of various languages for expressing a set of detailed instructions for a digital computer."
    And HTML is a set instructions to Web Browser, expressed in some kind of tag language.

  • If we look from a layman's perspective it really is a programming language. An extremely limited and interpretive language yes but it is one. Javascript is the same.

  • This is such an odd argument. I think it only works by generalizing what "programming" means, and also accepting assumptions for how a browser parser behaves.

    Given that, in the DOM, there is no `h1()` function… not sure how to accept this. The DOM gives the ability to create text, and imperatively add text to it.

    But as far as I know, I don't think it's as functional as the professor implies. Creating an element and adding text to it is a two step process, all the time. Unless the rendering engine does something I don't know… which is possible.

    What I do appreciate is how the professor puts loads of qualifiers around his statement. He doesn't blanketly state it's a programming language. He's careful with his language and cautious in framing his argument as to not be a general statement.

  • discussing semantics again… let's look at the definition: "A programming language is a formal language, which comprises a set of instructions used to produce various kinds of output".
    HTML (and CSS while we're are it) is a programming language under that definition. A declarative, domain-specific programming language.
    If you take the narrower definition as most people do, which pretty much just includes imperative programming languages, then it's obviously not a programming language. But no one is saying that it is (under that definition)

  • He is a phd in CS with years of experience in his field. If he is classifying html as some sort of programming language i am inclined to believe him. Scholars can have these sort of disagreements. Although for newbies to programming html as a programming language rather than a markup language can be a bit confusing.

  • HTML programming language? NO!, a programming language has to have something doesn't matter how incomplete or restrictive it is, a programming language must has VARIABLE handling & FLOW control, to be considered "a programming language". When it hasn't these two thing, it is not a programming language. You are drunk Computerphile, go home Computerphile!.

    HTML it is not like calling functions (because functions can return values and the code can react to the given output), and that matter, HTML is just an output, like simple .BATCH ECHOES are (saving the differences in visual capabilities).

  • According to this man, almost every digital form of text is written in some sort of programming language. Not only is it not true, it is also extremely un-useful. Like the Facebook messenging system where you can surround a word with asterisks for that word to be printed in bold. According to the definition presented in this video, that would make the Facebook messaging system into a declarative programming language interpreter, would it not? It should be obvious to everybody reading this comment that it cannot and should not be the case. We would lose every meaningful use of the term 'programming language'.
    If you are still insistent about HTML being a programming language, please tell us: where is the line between programming and non-programming languages drawn?

  • Just being declarative doesn't make it a programming language.

    That statement was a declarative statement. It also wasn't programming.

  • It is also known as a Markup Language. According to Google, "a markup language is a computer language that uses tags to define elements within a document."

  • HTML is a "programming language" in the same way that INI syntax is a "programming language". Bash scripts are more of a "programming language" than HTML documents.

  • I was going to disagree but after having programmed in JSX for some time I must conclude that by defining JSX as distinct from js itself, by definition, defines html as a programming language. Otherwise to say JSX is distinct from js would have no meaning. Which then of course calls into the conversation the declarative JSX html versus the lower-level html it turns into. The point is regardless at some point the js stops and the html begins, and this distinction between js and html means html must be viewed as a programming language, regardless of the limit of its scope, similar to the relationship java has to the c/c++/assembler the java language is built from.

  • Anything that constitutes a list of instructions that a computer executes is a program and is programming. That includes HTML.

  • This is an argument from absurdity. I'm very familiar with declarative programming, and have built declarative DSLs. HTML is, by design, declarative in nature, but it still isn't a programming language at all. It only describes information and the offer of interactions with the same or other servers.

    Yes, you can abuse a variety of things to do programming badly, like regular expressions etc., but that doesn't make it a programming language.

  • HTML can be thought of as a scripting language. That is is a specialised language tied to a particular environment or task as opposed to a general purpose programming language which puts a premium on portability and generality. Other examples would be the macro languages of word processors or tech drawing apps etc. and OS shell scripting languages + AWK, SED etc.
    The definition encompasses a wide variety of tools and levels of functionality and people will differ about where to draw the line and what to exclude altogether. Nevertheless, I think it is a useful way to think of HTML, (though not the only one).

  • modern html is very much a programming language. with the advent of frameworks like angularjs and angular, it has shown that you can add logic into html (if & for loops for instance) using html. i have no clue why this is still a debate.

  • Thank you very much for this video. I stand with HTML is a programming language.

    In general sense, we tell computers or a service to do something for us. We call it "programming". We are programming web pages by providing meaningful tags with arguments and attributes.

    The web browser will interpret our tags and do all the renderings. Just like any other interpreted programming languages.

  • Especially with things like Electron becoming more mainstream, I think people are beginning to view HTML differently.

  • So for my games pathfinding I created some functions to speed things up. Am I right in saying that when I call one of these functions (eg. NodeFromWorldPos(Node)) this is declarative, while writing the functions themselves it was Imperative?

  • There are two kinds of people who will tell you that HTML is a programming language. One is the newbie, and you need to set them straight for their own sake. One is the professor who was around back when the concept of programming languages was formulated, and you need to sit back and listen. You don't need to accept the statement as ultimate truth, but it will improve your thinking on the subject. Shoes come in boxes, concepts don't.

Leave a Reply

Your email address will not be published. Required fields are marked *