I‘m in a bit of a pinch. I‘m currently part of a team that needs help with C++ development.
My background is around 9 years of iOS / macOS development using ObjC / Swift and a few projects using C#.
In the recent months / years I tried to hone my software-craftsmanship and stay up-to-date on stuff like TDD, functional programming, protocol-oriented-programming, moving away from objects, and so on.
I could help out my team and my employer by diving into C++. However I have some prejudices which I want to sort out:
- I’m hesitant towards C++ as it seems an ancient programming language and I don’t know for how long it will be around.
- I‘m hesistant on investing time into C++ as I don’t know how much acquiring this language as a skill will help me advance my career as a software-developer.
Could you provide some pro/contra arguments?
Best wishes from Southern Germany
Twenty years ago, I learned Delphi rather than C++, because I thought C++ is an ancient language, and Delphi was modern.
Now Delphi is basically dead, and C++ is still around.
It will be around for a long time. This shouldn't be a reason not to pick up C++.
> I‘m currently part of a team that needs help with C++ development.
That might be a good sign that you should pick it up but the details matter a lot. Getting to the point where you're productive with C++ in an existing codebase takes a while even for people who are experienced with the language let alone someone who is just learning it. So I would invest the time to learn C++ for work only if it's a long-term project where you'll have the necessary support from the rest of the team and from your engineering management. You need to establish the expectation that you can't just jump in and immediately make meaningful contributions. If it's a case of "this old C++ repo runs a critical piece of our product and we need a person to make some changes and maintain it", then stay as far away as possible.
There are a lot of reasons to learn C++, but the turnaround time isn't great. If you don't know the language at all right now the time it will take until you can likely provide meaningful changes to your team could be months away. One counter argument to that is that having fresh eyes on an old problem can yield useful results sometimes, similar to rubber ducking. (https://en.wikipedia.org/wiki/Rubber_duck_debugging)
As for C++ "not being around" anytime soon, very unlikely. C++ has outlived many languages and will continue to outlive many more. Virtually any major web browser you are using (or it's primary components) right now to view this page are C++ based. (https://en.wikipedia.org/wiki/WebKit)
https://github.com/arximboldi/immer
https://github.com/arximboldi/lager
https://github.com/arximboldi/zug
Also, I very agree with what @jasode has said. C++ will be interesting for you if you can do interesting things in C++. That is the main reason I use it: there are certain domains where I work: professional music software, graphics, film, robotics, etc. where there are no solid alternatives (maybe Rust/Nim/Zig if you are very adventurous). This kind of software is actually really cool, it's creative and enhances artists's lives and does not live in magical "clouds" but runs on your machine. The language is imperfect and complicated but working in these domains is really cool and it makes the experience of taming the beast of C++ enjoyable :)
Sometimes, the counterintuitive situation is that the "ancient language" is the tool that enables you to write the most modern cutting edge application. My previous comment about this: https://news.ycombinator.com/item?id=25315815
>I‘m hesistant on investing time into C++ as I don’t know how much acquiring this language as a skill will help me advance my career as a software-developer.
It will help your career if you become highly skilled at C++ and it's easier and more realistic to build competency if you have interesting projects that require C++.
In other words, a lot of people don't learn LanguageX because of some elegant syntax feature or a vague "future value". Instead, they learn a new language because an interesting runtime or target environment requires that particular language.
E.g. I previously ignored Python for years. But now I learned it not because I like spaces as indents instead of curly braces or because of Python mantras such as "One True Way To Do Things". I learned it because the new field of AI machine learning interests me and the lingua franca in that topic is mostly Python and not C++. I learned Visual Basic because that's the language of Excel macros. I learned Bash because that's the default shell in Linux. And so on.
In summary, C++ would be easier for you to pursue if the problem domains that C++ is good at are areas that naturally appeal to you. Stuff like close-to-the-metal coding such as backend server processing, high-frame-rate video games, etc. Is your team's C++ code base interesting to you? If not, learning C++ will be a slog.
Whether a change to more C++ development will be good for either you or your team is a more open question. I was primarily a C# developer and got into C++ because I ended up in a company where it was being used and had to be supported. I have never coded in Swift and have done almost nothing with objective C, so I will not comment on them. I have been coding periodically in C++ for the past five years, and to me it always feels slower, more difficult and less enjoyable to write something in C++ than to do the same thing in C#
It is true that C++ is a powerful and flexible language and there are places where you will be hard pressed to find anything that works as well as it in terms of raw performance or fine grained control. But because of its age, many features which can be taken for granted in a language like C# have had to bolted on to C++ and lots of those bolts look ugly. There is also a lot in the language, and if you're going to use a language feature then it really helps to understand it in depth, because its depressingly easy to write code that is badly wrong in ways which will not be easy or quick to detect.
If your team's need for C++ support is going to be a long term thing (ie they're still going to be needing you to work on this stuff a year or more from now) then it may be worth their time and yours bringing you in to work on the language. If not, you may well cost more in terms of what it takes to get you up to speed than the benefit once you are fully productive. (This, of course, will vary depending on many factors such as the quality of the code base, the range of language features it happens to employ, the amount of support you can expect from your co-workers and how competent you are at learning a new language. These are things that only you and your team are able to decide.)
Learning C++ makes learning other languages easier. It's C++ that made me grok the difference between stack and heap allocations; it taught me about moving semantics, dynamic arrays, reference counting garbage collection, data structure alignments, dynamic/static linking, segmentation faults and many more things.
The above things made me understand better how other programming languages work under the hood.
At times I find C++ code that is of intrinsic interest to me. Bitcoin, for example, was authored in C++. However I dread writing C++ because I find it very complex and it has outdated coding environments. Thus I am very happy I don't have to write it.
Or is the codebase using a relatively modern standard (such as C++17 or C++20?)
Does the team track new versions of C++ upgrade every 3 years so your not left behind?
Remember if your not upgrading, it means you and your team is not able to take advantage of the latest C++ features. For example C++ 20 brought lots of goodies such as Modules, CoRoutines, Concepts and a new Ranges library.
As a rough rule of thumb, the older a language still in use is, the longer it will be around into the future. I believe C++ will outlive you.
even if C++ went away next year (which it won't, and you can be sure c++ will be here until eventually quantum computing takes over ;) the concepts and understanding of computing you'll learn is still valuable
in terms of advancing your career as a developer, realistically speaking it will advance your career most probably only if you make a switch to jobs that require real time / embedded / high performance / security. for other fields of programing today, c++ level of understanding will not advance your career as much as being a good communicator, acquiring connections and brown nosing
1. Regardless of whether or not C++ is going away, your team needs help now. You have an opportunity to get up to speed and add value in the present. That could pay off in social capital, promotion, or just plain old appreciation of your efforts.
2. Say you don't care about your team's needs at all (for the sake of argument, I'm sure you do!). Learning C++ will teach you concepts and patterns that can help you be a better engineer, even if you move on to Rust later (which IMO will be C++'s replacement for new projects eventually). Growth happens outside your comfort zone, this could be a good growth opportunity.
C++ and similar unsafe languages have lost majority of the markets they once had. When I started my career in 2000, it was used for pretty much everything, people wrote C or C++ for desktop, web, mobile (PalmOS, later Windows CE), embedded (was mostly bare metal back then).
Over these 2 decades, it’s mostly gone from desktop (initially replaced by Java and C#, and now being replaced by JavaScript and TypeScript), gone from web servers (Java, then Ruby, then JavaScript/TypeScript), gone from mobile (Obj-C in iOS and Java in Android), and I think being slowly replaced even for embedded, I personally shipped embedded Linux stuff based on .NET Core.
Whenever you don’t care about performance too much, and have enough RAM — higher level memory safe languages are strictly better, IMO.
Still, there’re large areas when it’s unlikely to be replaced any time soon. Game engines are written in C++. Many low-level performance critical things like database engines are written in C or C++. C++ is all over CAD/CAM/CAE, 3D modeling and animations, VFX, everything related to multimedia (video streaming, processing, editing). And even some embedded: since you’re southern Germany, there’s probably a lot of work in automotive sector.
I think C++ is here to stay in most of these areas. When you have working set measured in gigabytes and want your software to be fast, the “have enough RAM” requirement of GC runtimes is often a showstopper. Large RAM requirement is expensive for code running on servers, and shrinks potential user base for code running on clients. There’re other things too: tooling, library ecosystem, performance in the broad sense.
What changed? There is code I need to do maintain in c++. If I don't do it, it might not happen.
Sounds like you are in a similar situation.
It feels weird learning a language competing with a HN darling (Rust), but I have the need.
There is a LOT of code in C++ out there. I write in it every day. There are a lot of open source project written in C++.
C++ isn't even that hard to learn, at least to a basic level of fluency, but there is a lot to know to be good at it.
Probably decades.
Things written in C++: web browsers, video/photo editors, audio software, compilers, and generally everything that needs the highest possible performance.
* It will massively increase your marketability: C++ is one of the most popular languages around, and it will stay this way for at least 10-20 years. Most desktop programs are still written in it, most AAA games, and most operating systems, most multi-media data processing uses either C or C++, and it's still the most popular language in the embedded space. Wherever execution speed is a goal, C++ is the lingua franca. As an iOS dev, these might be markets you didn't consider before, but knowing C++ will go a long way towards unlocking them for you, should you ever want to go into them. It will increase the potential places of employment for you like very few other languages could.
* C++ is powerful. It lets you do stuff that's out of reach in a lot of other languages. Have you ever thought "gee, this inner loop costs too much runtime but is easily vectorizable. Man I wish I could hardcode this piece of code in SSE intrinsics (or other modern CPU instructions) or write inline assembly"? Or "man, I could actually already compute this at compile time if the processor would let me" or "If I could store this information in the upper bits of the memory addresses that go unused, I could squeeze the data in a cache line, making cache misses almost a non-issue"? C++ makes these things (and many others) available to you, if you ever want to.
* It will massively increase your software-craftmanship: There are very few popular languages that will expose you to such a breath and depth of programming language concepts, From bare-metal pointers and references, manual memory management & smart pointers to template metaprogramming. At least for me, no other programming language has given me this many instructional "aha" moments, because C++ makes a lot of stuff explicit that is just hidden away in most other languages. Even if you end up not using C++ much later on, knowing and understanding the concepts of C++ will make you a much better programmer in other languages as well. And will make learning other new programming languages much easier. Haskell and LISP are the only two languages I can think of that had similar effects for me.
Contra (Arguments against learning it):
* C++ is difficult. It has massive footguns and error messages (especially in templated code) are sometimes not very helpful. A lot of things that are easy in other languages are suddenly hard, and manual. Some bugs are absolutely non-trivial, hard to understand and to debug, on a level that you haven't seen before. With great power comes great responsibility.
* C++ is old: This may just be a riff on "it's difficult". But on several occasions, it'll get on your nerve. The build and link system are outdated. And C++ in 1998 looked different than C++ in 2017. And the language is still evolving.
Than being said, my advise is to study for a domain that interest you, for example I am a Control Engineer. Then learn the programming language of your domain.
In my domain the design language is Matlab/Simulink, then when I got into the job market I realized that my career would benefit by learning 61131 (PLC languages), C and C++. So I learnt that. Now I am very good with the Qt framework, for example, which allowed me to enter a broader market of industrial application development.
So stop looking for an language to learn and better look for a domain that will ensure that you will have a job in the future. Then learn the language of that domain.
The main thing left is understanding pointers vs references vs stack vs heap allocation (egthe instance.x vs instance->x difference) because C++ has those explicitly different pointer vs non-pointer intances of "instance", while C# or Java hide that difference (so if you know C# you can slightly think of it as struct vs class in C# difference since struct is copy-by-value while class is always a reference (a pointer).
Moving away from objects doesn't make sense: objects are perfectly fine and usable. It all depends on the context. Anyone who says "don't use objects" is a religous zaelot who does't see the forest for the trees anymore. For certain extreme performance cases objects can be bad, but in ~95%+ of cases objects are perfectly fine. We are again starting to enter "it all depends on the context" territory.
IMO C++ got some very bad rep for no reason at all: it got mythologized into a "very difficult arcane language that people makes meme about". So because of this people think C++ is some boogey man, while it's really not. Unless you are making life-critical software like avionics it honestly isn't much more difficult than C# or Java.
Ironicaly you already understand the difference between pointer and non-pointer since you know instinctively that an "int" type is will get fully copied while in Java a class object is a reference (pointer). C++ just makes this even more explicity since YOU can decide if a class is a copy-by-value or a reference on the fly (assuming the class doesn't have complex sub-fields inside of it that require their own complex copy-by-value vs reference rules).
Also due to C++ being mythologized as an "super difficult language" you get some extra XP on resumes if you state that you know it.