Why do Web Programming Languages Suck?

Being a rant - with some possible explanations

Posted by 01/25/2008

Programming a web application is a horrid mish-mash of languages, standards, and browser incompatibilities. It's chaos. It sucks. Why?

What do I know?

I've been programming web applications for a good 10 years now. I like the web. I'd much rather be programming a web interface than a proper GUI any day.

That being said, I still think web programming languages suck. They might suck less than anything else. But they still suck.

Why do they suck?

Why boils down to a few points:

  • They don't have features that most other programming languages do. They are anemic
  • Your code interpreter is whatever web-brower somebody happens to be running - you have no control over that. There are multiple browsers and multiple versions of each browser running on multiple operating systems. You're supposed to make it work on each and every one of them.

They are Anemic Languages

Years ago someone invented the first language for the computer. Since then there have been thousands of languages conceived of - 99.999% of which have been utter failures. But there are certain commonalities that have crept up over the years. Things that every language needs eventually:

  1. A module system - i.e. some kind of way to organize code in distinct packages and use select pieces from those packages
  2. Some kind of method of variable substitution i.e. somewhere I need to be able to say x = 5 then later refer to $x
  3. Loops and Conditionals - i.e. doing the same thing over and over again and testing whether something is true or not
      for (record in records) {
         print record
      if (x = 5):

Most languages worth their salt will have all three. I think it's no accident. Because eventually, once you write enough code in a language, you find that you need all three. That's why they came into existence in the first place.

The Top 4 Languages of the Web

Now, here's the first question - what languages drive most of the web?

Answer: Html, Css, SQL and Javascript (in no particular order)

You can say PHP or Java or Perl or whatever you want to say - but when it comes to web programming those are all just languages that are used to generate code in one or all of those 4 languages. When you are viewing web pages you're primarily seeing Html, CSS and Javascript at work. PHP is just code that generates Html. Java web applications are just code that generates Html. You get the idea.

If you're reading this and you are not a programmer - than you should probably stop reading. But this is a functional summary of those languages in case you don't know about them:

  • Html = is the language of web pages. If you do "View Code..." in a browser you can see what it looks like. It's simple. It consists of tags to describe content. And there is a tag for the beginning and a tag for the end. So for instance the <p> and </p> tag is for paragraph. To make a paragraph you just do <p>this is a paragraph</p>
  • Css = is the language that controls how web pages look. If you want to make all paragraphs in your html page super small and with white text you could put some code like this in a css file somewhere:
      p {
        font-size: 2px;
        color:     #FFFFFF;
    or if you just wanted to have just one paragraph like that you can do something like this directly in the html:
      <p style="font-size: 2px; color: #FFFFFF">this is a paragraph</p>
    why you have to type '#FFFFFF' instead of 'white' is one problem already. There are a multitude of problems with Css - some of which I've noted here
  • SQL = The language you send to a database to get database records back. It's pretty simple to begin with - and almost reads like a sentence
      SELECT users.name from users where users.id = 4
    It gets more complicated when you want to intersect records from one table to another, but you get the idea. It is something that must be communicated to a database. You send the query - you get the results.
  • Javascript = The language the manipulates a browser and the page it is displaying programmatically. Despite the name, Javascript has nothing to do with Java. It's code written in a language several browsers can interpret. It looks like this:
      function say_hello() {
    And is used to make interactive things happen on a page - like a message popping up or doing something with drag and drop or sorting a table - that sort of thing. Each browser has it's own interpreter of this language. And the interpretations are inconsistent. It is also full of security holes, hacks on top of hacks and memory leaks. But I'm not going to talk about that.

A diagram would be handy now

As you can see - the web has segmented itself up into layers - each layer being responsible for a different thing. It's not a bad system all in all. However, here's the second question - do those top 4 have any of the aforementioned 'essential' components that all languages need (according to Rob)?

Answer: No. And there's your problem

Html sucks

Lets start with Html. If you want to make a link to an image you write code something like this:

<img src="image.jpg"/>

Makes sense right? So why can't you include another html page like this:

<include src="header.html">

No good reason. But this is something only certain web servers can do. It's called a server-side include. And it looks more like this:

<!--#include FILE="header.html"-->
If I can embed images in a document why can't I embed another document in a document?

Well I can give you 3 good reasons why - but really those are all implementation problems. It sure would make adding headers and footers to a bunch of html pages a lot easier. And this was a problem 10 years ago. And it will still be a problem 10 years from now. 10 years is a long time.

Let's say I want to make a snippet that I use on every page. Some bit of redundant code that I'm tired of typing over and over again. There is no good way to do this with Html. Here is how I would imagine it could be done:

I make a file called 'snippets.html' - with the following code in it:

<?div id="meta-tags">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Last-modified" content="0">
<meta http-equiv="Cache-control" content="no-cache, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">

Then I put this code in one of my files:

<include src="snippets.html#meta-tags"/>

Now that's just the beginning. That just adds the ability to piece together fragments and organize fragments (a pseudo modular system). Imagine something that looks for variables as well. Remember we need some manner of variable substitution (because that is one of Rob's essential features). So here's an example of how that could be done:

(Here the variables would be $name and $value parameters):

<?div id="meta">
  <meta http-equiv="$name" content="$value">
And we could create another snippet in which we send the values we want for those variables in a link to the snippet. That way we've built up one fragment from another fragment - and it's more flexible that way.
<?div id="meta-tags">
  <include src="#meta(name=Content-Type, value=text/html; charset=iso-8859-1)">
  <include src="#meta(name=Expires, value=0)">
  <include src="#meta(name=Last-modified, value=0)">

Then I can put this in one of my files:

<include src="snippets.html#meta-tags"/>
instead of having to type it over and over and over again in each and every file.

It's called organizing your code. And Html doesn't let you do it. So people are forced to buy some kind of monstrosity like Dreamweaver just to accomplish these things. It really should not be that way. It's yet another case of making the tooling the focus - instead of the language. You could keep it simple - and you could make it fault-tolerant (i.e. not crash if you do something wrong). I'm not asking for closures or anything. Just some slight improvements.

And this is just addressing the 'module' requirement - i.e. the ability to organize code. I haven't even talked about looping. In fact I haven't even scratched the surface of what Html is missing. Think of all the times you enter a date on a web form. And all the variety of problems with that. All the different kinds of date widgets - all the "please enter date in mm/dd/YYYY format" messages. Just imagine if the Html code to gather a date value in a form were as simple as this:

<input type="date" name="start_date"/>
It should be. We've seen a variety of kludgey date drop-down fields over the last 10 years. This is so incredibly common. Why isn't it a standard Html component by now? It's a standard component in any other GUI framework.

Css Sucks

Css. The bane of every web programmers existence. That god-awful mix of magical browser-specific incantations and superstitious cruft code. I can't even begin to describe to you how bad it is. And that's not even what I'm complaining about now. That's an entirely different post that I've already referenced twice now. Right now I'm just focusing on the language itself and it's limitations.

When I'm writing CSS code why can't I do something like this?:


tr.odd {
  background-color: BACKGROUND;

.highlight {
  background-color: BACKGROUND;

It's just variable substitution. It's not that complicated. But CSS doesn't have that. Everywhere you need #FBFBFB you need to actually type it in. It would be even better if I could do this:

get-background() {
  if ($theme = 'desert') {
  } else {

tr.odd {
  background-color: get-background()

And include something like this on an html page - setting the variable 'theme' to the value 'desert' in the process:
<link rel="stylesheet" type="text/css" media="screen" href="style.css(theme=desert)">

And I haven't even talked about loops. How about something like making odd and even table rows different colors ('zebra-stripes' as they call it). Why do I need to use another programming language to do that? Why can't I write code like this in CSS?:

HIGHLIGHT_COLOR := { background-color: #FBFBFB; }
NON_HIGHLIGHT_COLOR := { background-color: #FFFFFF; }

for (tr in table[.listing]) {
  tr.class = cycle(.even .odd)

The specifics are not important - you get the idea. Css and Html both should have at least a modicum of the features that most major languages have. Because, even though it doesn't seem like it, eventually everybody wants every one of those 'essential' features. It's funny that way.

SQL Sucks

I count SQL as a language of the web because so many websites are database driven. I should be able to make a variable in SQL for a list of fields, for instance, in a set of code I can reference easily - and be able to pull it into a query whenever I want. It might look something like this:

module user

define fields
    id, lastname, firstname

then in the actual query:
include user.fields

select (user.fields) from table users
Or imagine this; A module with a function that returns a snippet of SQL - takes a few variables and then lets me build up a SQL statement by concatenating calls to that function. Make sense? Here's an example:
module billing.statements

function day_when(date, dayname)
  SUM(when DAYNAME(date) = dayname, 'billing.time' else NULL)

require billing.statements

report_sql = day_when(billing.date, 'Monday') +
             day_when(billing.date, 'Tuesday') +

SELECT report_sql

One big problem with this idea is that databases don't really have a place for code to live. There are stored procedures and views - but those are implemented differently in each database. I'm suggesting they settle on something and make it part of the language.

And if you're reading this and thinking "This code is ugly. That's not what I would propose" then your missing the point. The specifics are not important. The idea is that any programming language should have the means for compressing, compartmentalizing and organizing code the way most programming languages(Java, Haskell, Python, and Ruby) do. I can shuffle around and reorganize my code all day long in those languages. It's just the basic tools of working with code. It's nothing special or weird or unfamiliar.

And as I discussed here all programming languages - even the ones that are supposed to be declarative and used by the 'masses' - end up being used by specialist anyway.

What People do Now

A lot of people use ORMs (Object Relational Mapper) to work with databases. An ORM attempts to translate the code and conceptual units of one language into SQL. So you can work in your favorite language the whole time - organizing your code into modules and functions - letting the language work past the shortcomings of SQL. There is nothing wrong with this. I use them all the time. In fact, the proposed code I wrote above is modeled on something I've done with SQLAlchemy.

And most people use a templating engine to generate Html and Css. All templating engines - JSP, PHP, ColdFusion, Django, Erb or even Dreamweaver - work around the limitations of those languages. They are great. I'm using Mako right now and am pretty happy with the results.

Still, it is my contention that this is ultimately the wrong approach. I think there is a reason all the major programming languages have modules, loops and conditionals. If these pseudo-languages of the web had those - you could either a) stop using those ORMs and templating engines or b) the ORMs and templating engine would be able to do some pretty amazing things. Things that would start to resemble meta-programming.

Javascript Sucks

Javascript sucks too. It sucks the least - as far as language features go - I'll admit that. But there is still no way to organize code in directories and libraries and pull in necessary bits and pieces with a namespace reference - i.e. no module system. I should be able to write Javascript like this:

require mylibrary.functions;
to pull in some useful functions I've written in 'mylibrary', but I can't. Instead javascript libraries have to include some kind of hack. In Dojo, for instance, you do something like this:
which by all accounts should be part of the language. Because all languages eventually have the same requirements. That's my point really.

Browser wars

The other problem with Javascript (and CSS) is the browsers. What a nightmare that is. If you don't program web pages then take my word for it. In C or C++ it common to write functions with a bunch of code specific to the environment. One bit of code for Windows, one bit for Linux. It'll look sort of like this:

void do_something() {
#if WIN_32
#if UNIX
#if BSD
everybody hates doing that - and, for the most part, you don't have to do that kind of thing in the more modern languages (such as Python, Java, Haskell etc...). There are a number of reasons why you would not want to do that - but it should be obvious. It makes everything very brittle. However, if you're doing a lot of Javascript (without using a framework like Dojo, JQuery, Prototype, YahooUI or whatever) your back in this world. It is for specific browsers rather than specific operating systems. But it's the same world. And it's an ugly world. Take my word for it.


Well - there it is. I've said it. The world is kludging together a coded system called the web - and the building blocks are fundamentally flawed. I believe in the wisdom of attrition and lowest-common denominator though. So what we have is probably the best we could come up with. I'm just complaining because the specifications for Html5 and Css3 have recently come out - and they both suck. So the suck-age will continue indefinitely. I haven't even scratched the surface. I haven't talked about the http protocol for instance.


Patrick commented, on July 16, 2008 at 8:44 p.m.:

I am not a true web programmer in the sense that I do not have clients, I just work on my own site.

I have no one to talk web programming with. I have sometimes wondered if I was just dumb or was the web really this screwed.

It looks like the jury is back, the web really is screwed.

Thanks for talking the time to post this-Patrick

Patrick commented, on July 16, 2008 at 8:47 p.m.:

Oh one more thing.....

Flash sucks too, it cannot be indexed.

rob commented, on July 28, 2008 at 11:30 p.m.:

wow. a comment. Don't get a lot of those here :)

I could write 10 more pages about this really. It goes on and on.

The sad thing is the brightest minds in computer science (which does not include me) are being wasted on CSS hacks such as the "sliding-door" technique, or Javascript hacks such as passing session data around via frame window titles.

I think all web programmers could be spending their time with better problems to solve. These things are stupid.

And yes, Flash is not index-able yet. But there are plans to make it so. God help us then. The web will then become slick and bouncy and plastic.

I don't know what I mean by that.

Danielvog commented, on November 21, 2015 at 3:56 p.m.:

ciao humanity, Your Astella 8 *.

soloJeows commented, on April 17, 2016 at 4:44 a.m.:

Total: 0.34 Python: 0.06 DB: 0.28 Queries: 19