By Zed A. Shaw

C++ Is An Absolute Blast

I want you to ask yourself an honest question. When was the last time you actually had fun in programming? Looking back, I don't think I've actually had fun in programming for close to...10 years? I don't have fun with JavaScript, Python, Ruby, C, nothing. When I say "fun" I mean, you genuinely were excited to work on your project and the whole time you work on it you're thinking, "Damn this is a blast. I can't believe that wild idea I had actually worked!"

For example, I'm working on a little roguelike game and I had the idea, "I bet I could use this dijkstra algorithm to connect rooms during map generation by inverting the map and then running it. It'd probably make really cool carved out tunnels between rooms." I then had the greatest time figuring out how to pull it off and didn't feel like C++ got in my way. I managed to pull it off and learned a lot in the process. I then had the idea, "I wonder if I can take my FTXUI user interface and just render it directly into an SFML render window." Sure enough, I could totally do that too and not only was it not that difficult but I learned a lot about how C++ does unicode. None of this was easy, it was just all possible and I can't think of too may ways C++ would stop me from doing what I want. That's fun.

I think programmers have lost the story of why they got into programming in the first place. I know I didn't learn to code just so I can make a bunch of billionaires more billions. I didn't get into programming so that I can fight an immutable rendering engine into finally showing a cornflower blue button. I definitely didn't get into programming just to make a few authoritarians at the top of a random open source project happy.

I got into programming because it was fun. I remember staying up late until 4am desperately trying to get my shitty gwBASIC code to render a character to an MS-DOS console. I remember working on weird GUI ideas and network servers for weeks on end just because I had an idea. I remember fighting one bug for a month only to find out it was a stupid spelling mistake. I remember that all of this--even the frustration--was a hell of a lot of fun. Easily more entertaining than anything else I've learned.

One thing I definitely remember was that C++ was also a lot of fun. Even back in the day when it was an overhyped and honestly terrible language. It was fun because I could probably make almost anything with C++. No waiting around for someone blessed by the Python Illuminati to create that terrible wrapper around a C++ project's code.

But...somewhere along the way, C++ became...unfun, and I think the trend continued with every language to this day. The story of C++ is a possible warning to other languages, and a story of a great comeback from the dead that nobody realized happened.

The C++ Template Metapocalypse

In the late 90s to early 2ks, I was actively using both C++ and Java until I mostly quit using C++ about the same time the C++ community did this:

I do metaprogramming.

That's how it felt anyway. Just a bunch of idiots finding the new angle bracket shaped Template Metaprogramming Hammer and bashing everything nailshaped within 100 meters. I remember insane discussions with people who thought adding two numbers with a template was "faster" than adding two numbers directly, even though the assembly language output was exactly the same.

This obsession with using template metaprogramming for everything--combined with what I recall as a weird arrogance in the C++ standards committee to refuse to make things nice for programmers--is what tainted C++ for me and many people. It became the language for architecture astronauts who cared more about the Pimpl pattern and metaprogramming than actually making the language nice to use.

That's why I loved Java. Sun Microsystems totally cared about programmers and what they needed. Java had a Garbage Collector! Java totally would never end up doing the exact same thing. No, not at all. Java programmers would never become obsessed with insane boilerplate, AbstractFactoryFactory Visitor patterns, and caring more about standards than usability? No, never. <cough>

I think this is probably about the same time that many people my age quit using C++, and most of you probably remember an overly wordy complex language with a bunch of syntax but not a lot of gain for all the <> angle-brackets.

But, C++ kept evolving, and the standards committee seemed to realize that if they don't do something they'll become an obscure language only used by a single 10 trillion dollar industry. How pathetic!

They did the work, improved the language dramatically, and actually made it fun again all without losing their original goals. Sadly, nobody knows about this huge revolution in C++ so I'm going to update your perception of the language.

The Amazing Comeback of C++11

I want you to go ahead and look at what was added to C++ in C++11. Go ahead, click that link and look at that list of insane improvements. Let's highlight a few massive changes:

I honestly don't know what happened or why C++11 was such a massive improvement to the language but it reminds me a lot of ES6 in the JavaScript world. Just a complete overhaul of the language's philosophy and style without alienating the previous way of doing things.

Yep, C++'s Got That...Sort Of

More importantly though, C++ is now a more modern language with quite a lot of the things you find in other languages. Here's a list of some common things you may need:

C++ pretty much has everything you might need, but if I'm being honest, it can be hit or miss on quality. I'd say the quality is generally higher than you expect, and I'd say it's higher than what I find in JavaScript and Python. I think "hit or miss quality" is something I could say about every language if we're all being honest here. I mean, do you really think Python's package management is top notch? You do? Why are there like 10 package managers then? Do you really think any GUI API is good? How about filesystem APIs? I mean c'mon, they're all pretty bad, so I'd say C++'s are about the same, and most are slightly better. Things like FTXUI are amazing. The STL is pretty awesome too.

Yeah, Yeah, But You Said "Fun"

I can hear you now. "Oh yeah, well Rust has really good web servers...and...and data structures...and..uh uh uh a standard library. Rust is just as fun as C++!" Yes, my point is not that all these new things are what makes C++ fun. The point so far is this:

If you believe that C++ is old and stodgy with tons of angle brackets, pointers, and this-> bullshit you're wrong.

I'm finding that C++ is probably the most capable language in existence right now, by a vast margin. I don't think I've ran into anything I can't do, and not only that but there's multiple options for almost anything I want to do.

That's only a few examples, but the most important thing to understand is, C++ doesn't really get in your way. Since you have direct access to almost every library with C or C++ ABI, and also direct access to every OS, you're pretty much able to make anything you need by yourself.

C++ DGAF

Alright, so you can do anything you want with C++, and the C++ standards committee has corrected course to focus on developer productivity since 2011. How exactly is that fun Mr. Zed A. Shaw?

C++ is in this weird creative sweet spot where the language and the ecosystem are extremely high quality, but the language isn't popular enough to attract the weirdos who ruin languages.

You know who I'm talking about. Remember how I said that I left C++ because a bunch of weirdos went insane with design patterns and template metaprogramming? Then I joked that this exact same thing happened to Java with design patterns and insane XML files? Then it happened with Ruby when Ruby on Rails became popular. Then it happened with Python, and JavaScript, and Rust, and pretty much every time a language gets popular there's those insufferable idiots who ruin languages?

You see, C++ is unfashionable now so those morons don't care about it. C++ is so unfashionable even the White House hates it, so all those authoritarian douchebags who run around smashing you over the head with standards documents have fled to languages where they can peddle their bullshit influencer garbage.

Those idiots are in your mentions, yelling at people, "Why don't you use Rust?!" They're the ones who shame you with, "Why don't you use React?!" They're the ones screaming, "Why are you using so much unsafe in your Rust code?!" They're the ones who scream, "Seriously?! A for-loop in Ruby code! Gah! Amateur!" And thankfully, C++ is not popular enough for those grifters to profit so they mostly ignore it.

Well, actually the Rust weirdos will bother you but they're usually too busy making the borrow checker happy to actually get anything done so you can ignore them.

This means that C++ the language--and C++ the community--simply Does Not Give a Fuck what you do. Do you want to write a matrix library? Go for it. Want to make a GUI library? Go for it. Want to write a game engine? Sit on your couch in the dark and go for it. How about a weird game that watches you code and makes fun of you? Seriously, nobody cares and most people think it's hilarious or fun.

DGAF is Essential for Creativity

"But Zed, don't we need a Great Glorious Leader to tell us how best to behave? Won't C++'s lack of an authoritarian Benevolent Dictator for Life leave you without direction? Won't you make...dare I say...mistakes?! How can you possibly survive without the BDFL grifters shaming you into working for them for free?"

I mean, I think you are probably not saying this exactly but you're definitely saying it tangentially. This mentality is one of the biggest reasons why other languages are not fun. Other languages are strictly controlled by organizations that actively shit on you if you try to make something cool. If you try to make a competing project to one that a BDFL profits from, then you better be ready for their attack dogs to hound you for years.

I firmly believe that for creativity to blossom you need to be able to get your idea out without fear of criticism and shame. You have to be able to express yourself and only after you've pulled your idea out of your body kicking and screaming can you step back and look at it critically. However, once you get your idea out there you better be ready to critique it before someone else does. It's this change in modes from "creative freedom from criticism" to "highly focused on quality" that makes for great creative work.

The best explanation of this concept comes from a painting teacher I used to have. Actually, this was every painting teacher I ever had. They would walk over to student's unfinished work and try to correct it. They'd annoyingly stand in the wrong place--usually their 5' tall eyes vs. my 6'2" tall eyes--and say my drawing is wrong even though their perspective is totally different from mine. Or they'd comment on some aspect of the in-progress work that was difficult to judge because it wasn't shown in the context of the full painting.

The mistake these teachers made was that they assumed a "mistake" early couldn't be corrected as you go, and would stay a "mistake" in the final work. It's entirely possible that what the student finally creates ends up working just fine when it's finished, but in the middle of the process nothing looks right so trying to "correct" it is pointless.

This is an important thing about creativity these teachers didn't realize. Everything looks and feels like crap in the "ugly middle" stage. In the beginning things will seem great, but as you work everything gets messy because you're reshaping and moving everything around to reach your final vision. It's more like walking a tightrope than driving a car where you're balancing on a thin line trying to reach the other side, and the only way you learn to walk the tightrope is to fall over and over until you get your balance right.

A lot of other languages feel like people are constantly trying to push you off the tightrope midway just so they can sell you a car instead.

C++'s nearly unlimited space to create, combined with the relative lack of shame grifters makes it an incredibly creative experience. If I have an idea I'm only limited by my skills, not by a limitation of the language or some C++ blowhard influencer declaring me unqualified to teach because I don't like his Benevolent Dictator for Life.

cppreference.com is Amazing

I think cppreference.com is the best programming language documentation I've ever used. It has nearly every single thing I believe languages need except for one:

  1. Every single keyword and library is fully documented with reference material.
  2. Every one of these also has extensive working examples. I think I've only hit about 5% that didn't actually work as written, and most of those were due to the compiler's implementation not the documentation.
  3. Every single feature not only indicates the C++ standard version that introduced it but it also links to the exact standard documents and other reference material that standardized it.
  4. It has a search bar that uses duckduckgo so it actually does find things even if you make spelling mistakes or can't quite remember the exact terminology.
  5. In addition to fully explained reference material, very good examples, and exact version information, it also has full explanations of important concepts with examples. Take a look at the documentation on Copy elision. While still very technical, it is well written and includes many examples to show you what they're talking about.

The only thing missing from the cppreference.com documentation is how to install various compilers on different platforms. I'm kind of mixed on whether they should do this or not. For other languages this kind of documentation is very important, but for C++ I think they most likely would get pushback from various members (*cough* Microsoft) and probably can't. However, given that there's only a few C++ compilers and a few platforms, it's entirely possibly they could add a series of getting started guides.

It's Not All Puppies and Butterflies

While I'm having an absolute blast coding C++ I want you to understand that I do not in no way think the language is without flaws. Not even close. My thinking is C++ is now about as good as any other language out there, and that no language is perfect. You'll have annoying things to deal with in C++ just as you have to in any other language, it's just C++'s annoying things are different.

For example, in C++ it's a real pain in the ass to get a non-microsoft installer working on Windows. No, MSYS2 does not work. MSYS2 is hot garbage so shut up. I had to create a whole set of PowerShell scripts just to make installing compilers and dev tools easier.. If you think that's terrible, then why are you using Python? If you try to install any Python on Windows you have to deal with the installers not adding Python to the PATH...unless it's a blessed installer from Microsoft or ActiveState. Then the installers are allowed to add Python to the PATH on Windows.

You see, C++ wins here because I don't have to deal with some arbitrary backroom dealing that gave Microsoft and ActiveState a free pass to violate the apparent "law" that no Python installer shall use the PATH. That alone is a massive win for me. It's not fun to have to argue with idiots who think this situation is normal in Python.

If you think your language is superior, give me about 1 hour and I'll find enough irritating bullshit to make your language look like a pathetic usability nightmare. The all suck, it's just C++'s suckage doesn't seem to ruin its fun.

Just a few of the pain points I have with C++ currently are:

But, that's for another essay. For now, I just wanted to express how much fun I'm having doing dumb stuff in C++ and hopefully educate people that C++ isn't the language you think it is. If you ever see a course that tries to shame C++ with a billion angle brackets, just know that the author of that course is a clueless moron who has no idea what they're talking about. I mean, check out this GUI layout code from FXTUI:

  document_ = Renderer([&]{
    return hbox({
        hflow(
          vbox(
              text(format("HP: {}", player_.hp)) | border,
              text(status_text_) | border
              )  | xflex_grow
        ),
        separator(),
        hbox(map_view_->Render()),
    });
  });

Be honest, if you didn't know this was C++ could you guess what language it was? I rest my case.


More from Learn Code the Hard Way

Very Deep Not Boring Beginner Projects

A list of projects that anyone with basic programming knowledge can do in any language, but have a lot of depth and aren't boring to do.

OpinionPublished Oct 1, 2024

C++ Is An Absolute Blast

Where I try to explain why I feel like C\+\+ is so much fun, and to correct some misinformation.

TechnologyPublished Oct 1, 2024

Just Use MSYS2 You Say?

Debunking idiots on HackerNews who think a total beginner can just 'Use MSYS2' on Windows.

TechnologyPublished Jul 16, 2024

Solving the Worst Problem in Programming Education: Windows

I've created a set of install scripts for Windows that helps people install many different programming languages using standard tools.

TechnologyPublished Jul 11, 2024