Oh dear… there’s a category titled “C++” on my website…

Although I’ve spent the entirety of my post-college professional life as a web or software developer, I don’t have a degree in computer science. Unfortunately, I didn’t discover my interest in software development until I was about 21.

Like any good web monkey, my first language was JavaScript, (which I quickly learned to love — despite its oddities) and then I soon moved on to PHP (which I instictively despised — due to its shittyness). Java was initially learnt as a personal attempt to broaden my horizons, and has become my favorite programming language by far — elegant, simple, safe, clean, and mature. And of course, Python is a shiney, exciting toy that I like to pull out of the closet occasionally when I’m bored. Great fun, but entirely disposable.

I never had any reason to learn C…

I mean, no one really chooses to program in C++ do they? It’s either forced upon them by legacy code or unenlighted employers, right?

As previously mentioned, I’ve been reading Programming Language Design Concepts by David A. Watt which compares many of C++’s language features to Java, Ada, and even Python occasionally.

Today I did the unthinkable… While browsing the aisles of the Computer/Programming section of Borders, I picked up Bjarne Stroustrup’s The C++ Programming Language.

So I read the preface and first couple of chapters. The tired cliche of a terrible train wreck from which you can’t avert your eyes seems apt here. Surprisingly, it applies not to the language, but to the book. I just can’t believe the way the first chapter starts off… Stroustrup begins by showing some small procedural C code block and slowly, incrementally develops the example into a couple of (somewhat trivial) classes. This seems like a reasonable path to take, but I have to say that I’m absolutely astounded by the code in some of the intermediate steps. Is it really necessary to show such obviously wrong user interfaces to an algorithm in order to make a point or show what C++ has to offer?

Most of the books I read are written by Java developers about Java libraries or specifications. So, I guess I just didn’t realize how good we Java people have it. The examples in your typical Java book are light years beyond this. Certain concepts just don’t need mentioning, so basic are they to the refined sensiblities of Java developers.

The preface (which is freely available online, so I assume it’s okay to quote here) makes mention of several languages, but, of course, never acknowledges the existance of Java. There are several thinly veiled attacks, however… like this:

The Connection between the language in which we think/program and the problems and solutions we can imagine is very close. For this reason, restricting language features with the intent of eliminating programmer errors is at best dangerous.

Oh puh-lease. He doesn’t believe this, does he? I mean, this is just propaganda to get you to use his programming language, right?

Some other eye-watering comments:

If the implementation of two classes have something significant in common, make that commonality a base class.

Yikes! Really? Imposing atrificial inheritance on two classes to simply share code seems a very bad idea. If two classes didn’t strike you as being related enough to share a common ancestor when you were designing your system, it seems really unlikely that inserting a base class to share a little common functionality is not really the answer to code reuse problems. There are much better techniques like composition.

Am I being critical? Yeah. But as far as I can tell this is one of the premiere oo software development books on the market… I’ve seen it referenced many, many times. This advice is amateurish for a book that appears to be targeted at experienced programmers. And this is the 1997 edition!

And then this:

Remember that much programming can be simply and clearly done using only primitive types, data structures, plain functions and a few library classes. The whole apparatus involved in defining new types should not be used except when there is a real need.

Eeeewwwww. This is one of the people who is largely credited with bringing object-orientation to the masses speaking!!!

Java, I’ll never foresake thee!


About this entry