My reasons to hold on to C++ for years to come.
“C++ is dead”
I’ve been hearing this since I went to the university. That’s like 10 years ago. Back then Java was already dominant language in the corporate world, at least in the USA. If you’re a programmer you’re probably familiar with the Joel Spolsky’s famous rant about JavaSchools (good read as always from Joel). It’s dated Dec 2005. C#, which came around in 2000, was a Microsoft answer to Java and was also said to be C++ killer. Then, the dynamic languages were all the rage. Ruby and Python began trending. Given all those easy-to-use languages, why would you choose C++ for anything? Isn’t that a prettier C, which again is a prettier assembly language? If you have an hour you can listen to a great talk given by Herb Sutter, and if not, there’s a shorter talk with concrete examples. Take look a TIOBE index and you’ll see that C++ occupies a steady 3rd place in the list of the most popular languages for the past 15+ years. Not bad for an old language. Which brings me to another point…
How do you like them pointers?
Most people who instantly associate C++ with pointers have been taught the wrong way. It’s the old school of “C with classes”. I know from my own experience how bad it is. Exercises with passing multi-dimensional C-arrays to functions. Pointer arithmetics. Manual memory management as if containers and smart pointers didn’t exist. Implementing doubly-linked lists. All that, which should be taught in C classes. Maybe there’s nothing wrong in teaching C++ this way? Well, Think again.
Of course, a professional programmer should understand how pointers work. But that’s not what modern C++ is about. C++ is constantly evolving. What used to be deemed proper code yesterday, can be considered bad style today.
The language is getting overhauled. Quoting Bjarne Stroustrup: “C++11 feels like a new language: The pieces just fit together better than they used to and I find a higher-level style of programming more natural than before and as efficient as ever”. C++ now has lambdas, memory model, range-based for loops, move semantics, variadic templates and all other less or more advanced things to help you with a task at hand. You have some old code, which needs an update to the new standard? Boom! clang-tidy to the rescue. It’s a super cool tool that uses static analysis to find old patterns in your code and suggest how to alter it. Lack of tools was always a pain when working with C++ but that’s changing. You thought only Java has automatic refactorings? Listen to Chandler Carruth, the LLVM/clang ninja from Google. They apply automatic refactoring to 100 million lines of C++ code at once!
Corporate codebase reality
Lots of CS undergrad folks imagine their careers are going to be sort of a rockstar/ninja/superhero experience. “Just wait ’till the world can see what I can do!”. It has to be this way because, well, “I’m above average“, right? You expect long hours of designing and implementing complex algorithms (at least I did). Then you get your first job and WHAM! You get “schlonged” with 20 years old code that appears to be the result of experimenting with hard drugs. strcpy with fixed buffers scattered over hundreds of files, thousand-line-long functions, 5 versions of hand-written linked lists – you name it. You roll up your sleeves to somehow clean up this mess. “Hold your horses, young apprentice! Business needs this feature implemented yesterday. No, we can’t use new GCC, ’cause the other team’s not ready to switch” – says your manager. Now you think “where did I make a mistake…”.
This problem is not C++-specific. Happy debugging of some old Java code created by a reflection enthusiast. If you’re a web dev you’re likely to be exposed to some radioactive PHP. Even if you code in Ruby or Python or some newer language, the amount of grunt work can suck all the energy from you. “Can you move that button to the right and make it pink?”. That’s the reality of working at most companies. What I’m hitting at is that, barring the swaths of legacy or boring code, there are programming jobs that are both challenging and entertaining with a minimal amount of business BS. Some of those jobs happen to be found in areas where C++ shines…
Where C++ is king: games, HPC, compilers, financials…
If you want to avoid spending your lifetime implementing CRUD stuff, you might consider learning C++ along with choosing a niche. Here are some of my propositions.
Game industry. Almost all AAA titles are created using C++. Video game developer is considered to be one of the most rewarding jobs in a software industry. It’s also one of the most demanding areas of it. Speed is very important, which is why writing effective code is essential. Other than knowing C++ specializing in game dev is mostly about learning theory and patterns that transcend particular API/libraries. Strong graphics and mathematical skills are often required. Enough to learn for a whole career.
HPC. Crunching numbers at extreme speeds requires excellent knowledge of underlying hardware. That knowledge has to be applicable directly in the language. The appearance of GPGPUs along with parallel computation frameworks such as CUDA and OpenCL created demand for C++ programmers with this kind of expertise. If you’re into scientific computing there’s a plenty of jobs out there. Have you heard about machine learning? It’s a hot topic nowadays.
Compilers. This is my favorite area. The LLVM project is such a huge success that it’s hard to find a popular language which either doesn’t have front end written using LLVM libraries or doesn’t use LLVM to generate bytecode. It’s all C++. Although compilers are written in various languages, the theory standing behind implementations is the same in all cases. You get to work with optimizers, static analyzers, debuggers, standard libraries, linkers and all other related tools. There are engineering problems along with theoretical ones.
If you’re into financials, there’re plenty of jobs requiring ability to write low-latency code. Mathematical background is a big plus in this area. Probably most of those jobs involve developing and maintaining high-frequency trading platforms. Also, it’s a great domain if you don’t want to call yourself a programmer. I’d say quants have the most opportunities to get big bonuses among all coders.
That’s just a handful of propositions. What’s common for those niches is that you simply cannot throw large enough number of Java rookies at a problem and expect them to come up with a working, maintainable solution. There’s a lot of domain knowledge required, which you can only get when working with experienced people. That means they are not easily replaceable. Ergo, companies have to pay them more and give them interesting problems to work on in order to keep them. Of course, there’s grunt work to be found everywhere, but it’s much more tolerable when you work on something you genuinely care for.
If you have your own C++ niche or disagree with my line of thinking, please let me know in a comment.