Worse Solutions For Problems People Who Are Knowledgeable Have Occasionally

Author’s note: This is not an up to date rant. It is for the most part still relevant, however.

I used to hate C++. And now I’m starting to feel that this hatred was well-placed.

The more I think about it, how my projects with it go, how hard it is to understand other people’s code, how much trouble C++ has given other people I know, the more I realize: C++ is just really garbage.

And, my biggest issue, lately, is that 90% of other languages are simply
*better* than it. As for the other 10%, I find the same or similar issues with them as I do C++. (That is to say, I don’t mean to rag on C++ specifically, but it is a great hitting dummy.)

Even Java – which I quite dislike for quite a lot of reasons – has something that C++ doesn’t: you can READ it. You can understand it. Even if it is insane, verbose, and awful all around, it is at least consistent in being awful.

The decision I’ve made is that I really just want to write everything in C. Or D. Or Ruby. Or all three. Fuck it, I’ll write shit in Go, I don’t care. I just don’t want to write object oriented code anymore. Not like C++ does it. And not usually like C# does it. Not like all the languages that take after its broken model and that influenced it do.

One thing is generics. Generics can go to hell. As I was first writing this, I opened the Wikipedia page for generic programming for some reference, and the first quote on the page is both fitting and a summation of my entire experience writing overly-generalized code over the years:

Dynamic, highly parameterized software is harder to understand than more static software.

— Gang of Four, Design Patterns (Chapter 1) (ISBN 0-201-63361-2)

Generic programming is an abhorrent concept. I’d maybe go as far as to say it’s broken. It feels like throwing your code in a blender just because you may want to use it a few times.

This is awful.

If you want to reuse your code, perhaps you should consider instead of
bloating your compiled code, bloating your headers, making your code so
extravagantly terse and crushing all dreams of a sane compile time, you should just carry out the effort to think, “Hmm, how will I use this? Then, how will other programmers use this, and how MIGHT they use this?”

It’s not even that hard, I’m sure most programmers have experienced that such questions are already answered in the back of your head when you’ve got enough experience on the subject of the code. Just think. THINK. That’s what you’re doing to write code; and that’s what you should be doing to plan it.

The complexity of C++ is caused by so many things like this. Concepts that
make you ask, “Why? Why go through the trouble of doing something that doesn’t even help you?” There is simply too much.

Another such example is its broken concept of the object. Object oriented
programming is NOT a broken concept. It’s the best thing when done right.

Just look to D for example. The combination of UFCS and all member functions being virtual is a perfect combination. Virtual functions provide a nicer interface to function pointers, letting you use functions as data with ease, and UFCS provides for the need of implementing functions for an object.

That’s all you need. Really. And please don’t say, “but that’s not no-cost!”. That’s exactly so. The concept of a member function should merely be so that it may give you extra information for the type. That’s why it’s IN the type. You are directly instructing the compiler to add more data to the object type, just that data is a function.

C++ does this wrong. A lot of languages do this in a way that I hate. The way of adding type info that has no purpose. Why bind member functions to the type? It becomes the same issue as generics – why? Why go through the trouble of putting crap in your type that’s just a regular old function?

Fuck.

Let me tell you something. C just works. C works well for a lot of people.
I almost want to say it works well for everyone, but that just isn’t ever going to be true. I think there are lessons that people ignored from C; or lessons that were unfortunately mistaken. Hell, I’m sure any language design geek would understand these.

C lacks concepts and paradigms of most high level languages. This limits the programmer to working with the small, yet solid, feature set C has; making her think before writing. Like any form of art. You could draw a picture with no forethought if you were using an overtly complex tool, but it would have the subtlety of a train crashing into a dynamite factory. It would simply lack the vision that your art needs to be truly *beautiful*.

Okay, I’m rambling, sorry. What I’m saying is this is a blessing just as much as a curse, your code follows a dead-simple feature set and therefore will be dead simple. Any idiot reading it will just get it. You must apply forethought, and forethought breeds both creativity and beauty.

These are all just random thoughts I’ve had on programming throughout the
years. I don’t intend to change anyone’s views on “what language is the best” because, really, that’s dumb. The best language is the one that can get your project done.

Except Python. Fuck Python.