I saw an interesting question on stack overflow wherein the questioner asks why everyone keeps telling him that he has to learn C++ to be a professional developer. Although it is true that most of these discussions are just launching pads for religious wars and I’m not alone in my assertion that your language of choice is largely irrelevant , I do agree with the perhaps controversial notion that every working programmer should be at least conversant, if not fluent in C++.
Let me be entirely clear about this. I am not saying that C++ has to be your primary language or that you need to be a C++ guru to work in this business. However, it behooves you to be able to competently read and write basic code in this language. That is, you should at the very least be able to implement the FizzBuzz program and the cliched example of a Zoo program to demonstrate polymorphism without lifting someone else’s code.
Before you dismiss me as a platform snob, consider the following six reasons that you need to know C++
1. You should learn C++ for the same reasons that people study dead languages like Latin. The syntax and other memes in higher level languages were inspired by or directly stolen from C++. This is blatantly obvious for Java, C#, and JavaScript. Learning C++ is a quick way to grok the syntax for a several languages at once and better understand their origins.
2. Understanding the details that are abstracted away from you in other languages (pointers, basic data structures, garbage collection, etc.) will ultimately make you more adept at solving problems when the abstractions innevitably leak or the stalwart underlying technology doesn’t live up to its stalwartitude.
Consider the real world example of anti-lock breaks, which allow you to maintain control of a car during an emergency stop. ABS has a completely idiot proof interface –Jam foot on pedal– that works just whether or not you understand that it will electronically pump the breaks to prevent the wheels from locking. However, during an attempt to thwart an impending moose collision it is certainly comforting to understand why the car is stopping in jerks instead of a smooth motion despite steady pressure on the pedal.
Also, this knowledge might have prevented my wife from listening to a shady mechanic who conned her into thinking that she had to pay his exorbitant rate to fix her ABS system since the truck wasn’t safe to drive without it to another mechanic for a second opinion.
3. Like it or not, C++ is the lingua franca of programming. Some would argue for Java, or even JavaScript, which may appear true in much the same way that the ocean appears to contain water because of all the wet swimmers who frequent it. It’s best just to accept this, but if you need reinforcement all you need to know is that Software Jesus (Joel Spolsky) agrees with me * on this, case closed.
4. Programmers and programming books that need to address programmers who speak an unknown or different language often use C++ for the same reasons noted in point #3. Learning this language will open access to more learning material and help you communicate with the programming community more easily.
5. One day you are going to need sully yourself and interface directly to a C API from the lofty perch of your high level language. In my experience a lot of tool developers avoid the hassle of maintaining separate COM, .NET, and Java API’s by just providing a a C API that will appease all the peasants who are not as privileged as they to “work in a real language.”
6. C++ on your resume can often lead to Salary++. I’ve found this is true even if the job doesn’t require any C++ programming. It is just respected as a more hardcore language and the credibility rubs off on those who use it. That credibility makes you more valuable.
* Update: As noted by a commenter (BTW: Thanks for the correction), Joel did make a definite distinction that new programmers should be learning C and not necessarily C++. Apologies for misstating his position. While it is true that for just many of the points I made, you could easily substitute C for C++ and get the same bang for your buck, I contend that C++ is a stronger foundational language for the points detailed in 1,3, and 4. Using a language that can’t talk about objects (C) to communicate with other programmers in an overwhelmingly OOP world isn’t gonna cut it.
Filed under: The Software Development Process | Tagged: c#, programming languages | 10 Comments »