The rantings of a beautiful mind

On life, society, and computer technology.

My Photo
Location: Toronto, Ontario, Canada

I live in the Fortress of Solitude. I drive the Silver Beast. My obsession is justice. I used to be a Windows software developer. I retired in 2000 when my stock options helped me achieve financial security.

Wednesday, November 15, 2006

C++ too damn complicated

C++ containers are like three-ring binders: they generally hold objects from a single class (or subclasses of that class). These containers are less flexible than Smalltalk’s, but safer, for any code that attempts to add an object of the wrong class to a C++ container fails to compile. This safety comes at a price, though, because you need to develop a class of container specialized for each kind of object you intend to hold—a SetOfWhale as well as a SetOfInteger. A C++ language feature (templates) simplifies the definition of such container classes, but container libraries in C++ still tend to be unwieldy, complex, and difficult to write. The need for fast, robust containers has spawned a cottage industry for container libraries. Sometimes these libraries are called foundation libraries, to acknowledge their essential place in object programming. Sadly, foundation libraries are sometimes not interchangeable [Standardization will help. The ANSI C++ standard now specifies a Standard Template Library.], because they are often integrated into larger libraries or frameworks that provide other services like windowing or communications or persistence. By contrast, every Smalltalk dialect includes an integrated foundation library—the subclasses of Collection. This library cannot be decoupled from Smalltalk because so much of Smalltalk itself is built using collection classes.

- Chamond Liu

Templates are one of the many, many reasons why C++ is such a bitch to program in. The C++ language itself is inordinately complicated, and as if that weren’t bad enough, the C++ infrastructure is a cumbersome morass of complexity. No wonder C++ software development is so costly and time-consuming!!

And now we see that Java and C# are headed in the same direction.

I’m not saying you should never use C++, but you had better have a damn good justification for it. Use the right tool for the right job. Make sure your reasons are not half-assed.

For most applications, Smalltalk is the right way to go...


Post a Comment

<< Home