The adoption of C++ was a necessary mistake. Why necessary? Legions of C programmers were not going to adopt OOP unless they could use the code they've already written and the libraries they've come to depend on. Also, the idea of not having to learn radically new syntax was a big ++ as well. In order to persuade the majority of the programming community to adopt OOP, it needed to feel safe and low risk. These programmers knew they needed a way to write better code. C programs were plagued by hard to maintain code that was as fragile as a new iPhone. Memory management pitfalls and buffer overflows could drive any normally sane person to question the virtue of being born at all. Many programmers surely went outside during a pouring rainstorm and, with outstretched hands reaching to the sky, would exclaim, "Why do you torment me so? Surely there must be something else you meant for us to use! Send me a sign!"
Unfortunately, the universe's answer was still unsigned.
"This new language was developed by Bjarne Stroustrup and was called C++. Stroustrup states that the purpose of C++ is to make writing good programs easier and more pleasant for the individual programmer. When he designed C++, he added OOP (Object Oriented Programming) features to C without significantly changing the C component. Thus C++ is a 'relative' (called a superset) of C, meaning that any valid C program is also a valid C++ program." (A Brief History of C++)
The idea that a modern language with OOP could exist seamlessly along with their C code and libraries seemed like a dream come true to developers. They would get all the benefits of polymorphism and encapsulation while still writing in a familiar syntax that works so well with their existing code!
C++ had the same pitfalls and caveats of C while trying to force procedural-minded programers to fumble clumsily with objects. What resulted was a collection of classes producing objects that were nothing more than struct function libraries and data objects. Polymorphism was often utilized as a clever tool of code reuse rather than creating true subtypes. C++ by virtue of being a subclass of C inherited everything that made mistakes easy to make while failing to override the procedural thinking that sabotages OOP design.
- There are no classes but there are functions that can have functions!
- Things are equal when they are not equal.
- Oh yeah, there is undefined, and there is null, and no, they are not the same thing.
- Many more
TypeScript has come to save the day from all this waaay too permissive insanity (or so it would seem).
Hindsight is 20/20, so what's the point if you don't share it with the world? Here's a few things I've been thinking about recently that I wish I could go back and tell fresh-out-of-college Kim. 'Cause man, she could have used a lot of help.