Benad's Web Site

For C++, it wasn't a good experience. At the beginning when I learned it I honestly didn't get at first what object-oriented design was. I ended up learning the syntax, the language, but for me it really felt like a kind of hack. The entire language did not represent something in the runtime environment [for features on top of C], that is the compiled code, so it was just a syntax difference, adding some extra language features in the syntax, nothing more. It wasn't exactly true, but still, a lot of things frustrated me when I learned C++.

The standard C++ library, I hated it compared to the C standard library, especially since it was overloading operators, something that disgusted me. Having been used to use the left shift and right shift bit operators seeing that do input and output boggled my mind. Things like the "virtual" keyword, which I would assume would be the normal behavior of overloading a function in derived classes, has to be explicitly written pretty much all the time. And it's a weird word: "virtual"? There's nothing virtual about it... It's function overloading! Templates, again that disgusted me even more, especially since when debugging the code that could lead to massive errors in your bugs and it's difficult to see which version of the compiled "templated" class you're using (because for every different type in the template it would compile a different version of the class). It's really weird. And that, coming from the perspective of someone that already had its own small library of C memory structures (like trees and lists) using opaque pointers, having to use templates I didn't see much the significance of that, except maybe a little bit of performance increase in some operations.

Eventually I bought the Inside Macintosh CD, the documentation of the Macintosh toolkit. What happened is that I tried to further develop my card game, to produce a user interface for that, and I said: "Hey! I could use Object-Oriented Design for that!" I ended up doing so many hacks with the user interface of the Macintosh that it barely worked, and I kind of abandoned it.

In my first workplace, where they heavily used C++, well, kind of, they were using a kind of Aspect-Oriented Programming approach, which I didn't knew what it was back then (and maybe didn't exist as a term back then [correct; the term "aspect" came from AspectJ in 2001]). But they were doing that using preprocessor macros, that is they were using preprocessor macros to generate code. It was, that and combined with bugs in the Visual C++ compiler from Microsoft back then, and the fact that the standard C++ library was a moving target, because it wasn't still finalized, it was a horrible, horrible environment. Since then I pretty much hated C++, especially since the next step was to learn Java, which is closer to a pure (not entirely) object-oriented programming language.

Published on August 25, 2009 at 11:45 EDT

Older post: APJ 2: C (transcription)

Newer post: Should I learn JavaEE?