Erik McClure

The Dark Side of Web Development

I am, by no means, a very good web developer. I am, however, a highly experienced C++ developer. The end result is that people usually ask me why I like C++ so much when everyone else hates it, and everyone is supposedly in agreement that C++ is the worst language ever made and unless you are writing drivers you should never, ever use it. I mean, you can write games in Python now, right?

While these kinds of ignorant opinions are frustrating for me and my fellow C++ developers who actually need efficient cross-platform programs, that’s not what I’m here to debate. In fact, if you think C++ is a complete piece of shit, I won’t argue with you about that at all. For all I know, you may be right!

Unfortunately for you, web development is just as bad as C++.

Of course, I just said that I’m not very good at web development, so doesn’t this disqualify me from having an opinion about it? On the contrary, the fact that I’m not very good at web development is extremely important. The reason is that one of the major complaints about C++ is that good C++ code is hard to write if you are an inexperienced developer. I can certainly attest to that fact, it’s taken me years to develop my C++ skills to this point. The fact that Python code is so easy and natural to write is one of its major selling points.

The thing is, good HTML/CSS code is also hard to write if you are an inexperienced developer. I can attest to this too, because I’m an inexperienced developer, and its really goddamn hard to write good HTML/CSS code. Let me clarify what I mean by “good” here: by “good” I mean code that works on all platforms, doesn’t blow up, and doesn’t contain strange edge cases that will cause it to fail for no reason. Many developers preach the joys of functional programming, which eliminates most edge cases by prohibiting functions that have side-effects.

Everyone knows about the subtle, nasty bugs that can crop up in C++, often as a result of doing something that was intuitive, yet wrong. This is rehashed in the “C++ is bad” arguments over and over and over without end, especially with the functional programming zealots. The problem is that HTML/CSS has all sorts of really stupid crap that can happen when you do something subtly wrong with the HTML that is not immediately obvious to a new developer.

It took me a while to learn that you shouldn’t be putting block level elements inside inline elements in your HTML - it will almost always work, until it doesn’t, and it won’t be obvious what exactly is going wrong. Many people new to HTML aren’t even aware of HTML resets, so they’ll have to try and remember which elements are block-level by default and which aren’t. Then the new standard introduced a bunch of psuedo-block level elements that try to fix some of these problems, except they aren’t supported by everything because MICROSOFT, so now you’re stuck with a bunch of workarounds for IE that take forever to develop.

Just recently I discovered an amazingly weird bug with my webpage, wherein upon first loading it, all my buttons would be stacked vertically. It appeared that Chrome was ignoring float:left on those elements… until the page was refreshed or any other part of the website was visited, at which point everything started working again! Firefox, of course, didn’t have any issues with it. The problem was that I had a <p> element defined as a giant button, then put <a href=""></a> around it because I wanted the entire button to be a link. This, of course, violates the inline/block element mandate I outlined above, despite it being a very natural thing to do - you want the entire button to link somewhere? Put a link around it. It’ll almost always work, until it doesn’t.

Trying to write perfectly standards conformant HTML is exceedingly difficult because half the time what you want to do isn’t in the standard or is some hack that works almost all the time but not quite. The rest of the time, the “standard” way of doing things is completely and utterly bizarre, like using margin:auto 0; to center elements. But wait, that only works on horizontal elements! If you want to vertically center an arbitrary element, you have to use a lot of weird crap just to get it to work on everything. Or you could just use a table. But tables are bad, so you should never use them, even though they actually solve a whole lot of problems new developers have because their non-table solutions are completely unintuitive, because we’re all trying to use a document layout engine to make GUIs, for crying out loud.

Many web developers argue that these problems are going away now that we have a better standard. Sadly, they are just getting started - WebGL will become exceedingly important in the next 5 years, and its standardization is an absolute mess almost to the point of it being unusable. Then there’s the sordid situation with HTML5 audio and video, which is only just starting to get tolerable. These problems are not going away - they are simply being replaced by different problems. Of course, some stuff actually is becoming easier in HTML - just like a lot of stuff is becoming easier in C++11. So either you ignore both the new C++ features and the new HTML features, or you admit that C++ has become less horrible recently.

Of course, C++ is still way too easy to write unmaintainable code in, and HTML/CSS code is clearly self-documenting! Except it obviously isn’t, given the endless horror stories of terrifying CSS dependencies with random !important keywords flung around in a giant mess that’s just as impossible to understand as templatized C++ hell.

But wait, if you just write proper HTML, it won’t have that problem! Well, duh, if you write proper C++, you don’t have that problem either. I’m sorry, if you are going to hate something, you can’t have your cake and eat it too. If C++ supporting features that can be abused to make code impossible to read, like operator overloading, makes it a bad language, then CSS is a bad language, because there is an endless list of obscure, bizarre syntax you can use in your CSS style sheets (like !important) that will make your HTML almost impossible to read. But wait, C++ is also incredibly hard to parse! HTML being easy to parse must be why Opera recently gave up trying to maintain its own HTML layout engine… Oh wait. Well at least javascript is a consistent, easy to understand language that doesn’t have any weird quirks… JUST KIDDING!

So it seems modern technology has succeeded in replacing a very fast, difficult to use, inconsistent language with 3 different, very slow, difficult to use, inconsistent languages.

Now, if you want to believe that HTML/CSS is still good when used correctly, then all I ask is that you grudgingly admit that, maybe, just maybe, C++ is also good when used correctly. If you still think C++ is an abomination from the depths of cthulu, I hope you can admit that web development therefore must also be an abomination.

Or we can just keep arguing with each other, because that’s always productive.



I think C++ and HTML/CSS both fell into the same trap: they became multi-vendor standards and picked up backwards-compatibility requirements before their design was properly sorted out. And since no one can unilaterally fix things that are broken about HTML/CSS or C++, bits of stupidity have been piling up through their whole histories. Technologies that start niche and stick to a canonical implementation seem to fare better.

Erik McClure

I think any popular technology invariably falls into this trap (just look at windows), but what needs to happen are clearly defined breaks in the standard. Instead of trying to backwards support everything, the standard needs to simply throw the entire language out the window and rebuild everything from scratch in a sensible way, and then clearly mark it as a new version. Then, you can have your old parsing engines for people using the old version, and new parsing engines for people using the new version - the old version is still available and supported so it can be rendered properly, but the new version simply uses an entire new parsing engine so its not kicked in the balls by old compatibility issues.

Juho Vepsäläinen

No wonder a huge group of tools (precompilers, whatnot) have emerged. It can get pretty messy at times. :)

As you said we're effectively trying to do things the tech wasn't originally designed for. The transition from documents to applications hasn't been seamless and we're still struggling to find ways to make it easier.


I believe that the result of using any programming language depends heavily on several key factors: The programmer(s), the design, the implementation. In the cases of both C++ and HTML/CSS, everybody has their own idea for how things 'ought' to work. So what the programmer gets is a different face for each different implementation with only the core of the language remaining unchanged, at least on the surface.
Then the problem becomes more complex, because of the internal workings. On the outside, a given language construct works the way you expect it to, but inside it could be using something that causes minor changes in behavior over a large set of input data (A simple example is the way that different processors handle an illegal div opcode).
Of course, C++ and HTML/CSS are among the worst affected languages when it comes to implementation differences. Python, Java and C# are all more or less 'single vendor', or at least the vendors are restricted in what they can do without breaking the language.

Apologies for the long reply. But to sum it up, I believe that the language is only as bad as the implementation; that being one of the core reasons I still don't use Microsoft and Borland compilers. GCC, at the very least, maintains it's standard across the OS platforms it supports.
With regards to HTML and CSS, I'll just say this: I have been tempted to throw a nice old "This page requires Firefox" message up. Often. Mostly with the CSS side of things.

Erik McClure

GCC is only consistent in that its consistently bad. It's support for syntax is random and incoherent (you should have seen the insanely bizarre syntax bugs I was getting just because the calling convention was somewhere that GCC didn't like, despite the fact that in other contexts it didn't complain!), it has actual, documented bugs with blatant missing features in C++11 that even VC++ has supported since 2010 or earlier (stream objects don't have copy OR move constructors, which is INFURIATING), and the way it implements some things is truly questionable. For example, its va_arg implementation is done such that it's some kind of array instead of a simple pointer, which causes huge issues when you start sending it into functions and expect it to not change because it doesn't seem like it should behave like a pointer. Then of course, there are the laughably inaccurate and totally useless error messages it spits out on a constant basis.

Clang is supposed to be better, but I've never tried it. GCC, however, is nothing more than a different way to poison yourself. Also, if you try to use it on windows, you actually have to use it in MinGW, which has a completely different core library, and thus is completely and utterly inconsistent in every way possible. MinGW fails to implement many threadsafe functions that are otherwise available on Linux, and provides no alternative.

So basically GCC isn't consistent at all. Mind you, microsoft's compiler sucks for a whole host of different reasons, but they both definitely suck equally badly.


Guess it's a case of 'choose your poison' then.


"WebGL will become exceedingly important in the next 5 years, and its standardization is an absolute mess almost to the point of it being unusable."

Citation needed??

I've made a number of WebGL applications now and I'm not really sure what your getting at here. Yes, we have the 16 bit limitation on drawElements and as always you have to stay the hell away from Microsoft. But if you only consider Chrome and Firefox because supporting MS anything is simply not an option for prototyping web apps then webGL provides the tools to rapidly put together some pretty awesome stuff with substantially less effort then in C++ (assuming an equal level of C++ and JS newbism).

Erik McClure

The issues with WebGL aren't as much getting things to work, its getting things to work fast enough:

David García

Every programming language has its own "The Dark Side of ...", even Python or Ruby deserves one. (selfness, tabs-spaces, endness, @#, ...)

Erik McClure

The primary purpose of this piece is to point out that web development shares many of the same problems that people love to use to bash C++ as being a terrible language no one should use. It's mostly trying to point out blatant hypocrisy in criticisms of various languages.

David García

I meant I concur with you :)



  1. 2024
  2. 2023
  3. 2022
  4. 2021
  5. 2020
  6. 2019
  7. 2018
  8. 2017
  9. 2016
  10. 2015
  11. 2014
  12. 2013
  13. 2012
  14. 2011
  15. 2010
  16. 2009