C++ Good, bad or worse?
I’ve used many different programming languages, each with their own set of benefits and flaws. C++ was the first one I learned, and every class that I’ve taken has used it (with the exception of two language classes).
Before we discuss the pros and cons of C++, here’s a factoid: C++ is based on C, which was written in 1972 (approximately 37 years ago) at Bell Labs for use with the UNIX operating system.
Here are a few of the things I don’t like about C++:
- No garbage collection
- Poorly implemented generics
- Local objects (there’s a reason no other language has them)
- Real pointers (most languages have replaced pointers with “references”)
- A tiny standard library (most languages have huge standard libraries, with Python and .NET being some of the best)
There are several libraries like Boost and QT, which provide an object model, handle garbage collection, and remove the need for pointers, making C++ more developer friendly. However, we’re talking about what comes in the box, not all the accessories that you can add after.
C++ is compiled directly to machine code, making execution faster than languages that compile to a byte code (like C#, Java and Python (which does compilation on the fly)) and require a runtime.
The real question is, does this really matter anymore? Most clients have duel or quad core processors, with clock speeds in excess of 2GHz, and servers have two to eight times the power of clients.
In my opinion, the answer is a definitive no. Why? Hand written assembly is faster than the machine code generated by the C++ compiler, but modern applications aren’t written in assembly. Does it matter anymore? Not really, thanks to Moore’s law.
Since we were able to move beyond assembly, I think we can safely shelve C++, and move on to languages like C#, Java and Python for 90% of software development.