Monday, November 23, 2009

C++ Programmers All Ought To Die, Die Motherfuckers, Die.

So I'm porting this 3D engine called Horde3D to Smalltalk. Why? Don't ask, it's too involved. Why Horde3D? Cause it's short. Naturally enough, it's written in C++ as every 3D engine seems to be.

Now, the quality of the code involved is pretty poor by my standards. Then again, I've got seemingly ridiculous standards. Seemingly because nobody seems to be able to meet them consistently. But this is something else.

There's this whole crap about templates. You see, instead of creating a Node and filling it with the parameters you want, you instead create a String with all those parameters. Then you create a NodeTemplate by cutting up the String. Then you create a Node by parsing the NodeTemplate. Niiiice.

Supposedly this whole rigmarole is so that you can make lots of copies of a standard Node. Unfortunately, it doesn't make any fucking sense. The right way to make copies is to ... copy. You create a Node and then you copy it lots of times. It's not difficulty.

But the rationale is more involved than that because IFF creating a node is ridiculously more expensive than creating a template then it can be a small win to create 1 template + N nodes rather than N+1 nodes. You know, cause that extra 1 makes a whole lot of difference.

Meanwhile, it doesn't seem to matter that there are two classes (or one struct and one class) instead of a single class. Or that there's code to check whether you've got an appropriate struct when you're trying to convert it to a node. As opposed to, you know, never doing any conversion in the first place.

But you know what? That doesn't even nearly take the cake. Cause now I've just discovered that matrix multiplication, yes simple matrix multiplication, is reversed! It's all fucking backwards. The operators and functions take two input matrices, m1 and m2, and instead of doing the seemingly inevitable of multiplying m1 * m2, it does m2 * m1.

Seriously, WTF?!

I'm not even gonna go into the complete lack of any coding standards in this piece of dreck. The morons can't even standardize on "return a NEW object based on performing this operation on this object" versus "become the new object".

And the worst part of it is that this engine is supposed to be the cleanest.

There is only one possible conclusion from this. C++ programmers must die. ALL of them. Every single fucking one.


Anonymous said...

What a stupid post...

sig said...

(in response to anonymous comment)
Not at all.
I can understand the feelings of author, because been there multiple times.

C++ steals your effort with all those templates, syntactic sugar etc etc, up to the point that once beautiful idea, when implemented in C++, turned into something horrible , unreadable and unmanageable (once you stop working on it for couple of days).