I seem to have a recurring conversation these days about C++, and how badly designed it is. Despite knowing the language quite well I cannot defend it, I’ve been programming long enough to have used pre-template compilers and to remember when compilers went through the “C with objects” phase. However any programmer might feel about the language it is damming is that is has never really supplanted C as a replacement language. New C projects are still being started despite it’s lack of OO. Many a major project is still being written in C. One recent thread on
git got quite heated. It is interesting to note that the person that Linus is arguing with is trying to port git to Windows. Much development on the windows ends up using proprietary APIs and it can be easy to write sloppy code. It is quite possible to create programs that will not link correctly. I don’t understand why some developers defend the platform when the APIs are in such a mess. That is besides the layers of libraries on-top of Win32 that bloat out your program.
It reminded me of a talk that Alan Kay— one of the inventors of Smalltalk at Xerox Parc— gave some years ago at OOPSLA’97 when everyone was claiming to be OO and objects were everywhere (that I’d watched years later):
It is interesting to see what is being done out in the world under the name Object-Oriented... I have been shown some very very strange looking pieces of code over the years, by various people, including people in universities, that they have said is OO code written in an OO. I made up the term Object-Orientated, and I can tell you, I didn't have C++ in mind.
I find his talk a little painful now; he seems to dislike much about the state of the software industry in the late-1990s. One clear message is that the language is a tool, if you are going to have advanced features in a language they should make the programmer’s job easier to translate their design into code, not add additional constraints that can cause the program to fail. Given this it is easy to understand the disdain for C++:
Part of the message of Object-Oriented Programming is that as complexity starts becoming more and more important architecture is always going to dominate material
Since this time, Object-Orientated patterns and other advances in OO have improved programming. I wonder what Alan would make of the industry now.