Why is C++ so hard to read?
I spend the majority of my time staring at C# code. And because I value my time, I have always made a purpose to program in a style that is easy to read and decipher. I don't use abbreviations for class, method or member names. I always call things exactly what they are. I use the same patterns wherever I can, etc. Nothing any rational developer would think twice about before doing. And, conveniently, C# makes it easy: it uses a minimum of syntax, has sensible document formating and relatively easy mechanisms for navigating around complicated structures.
However, I got a reminder today about why I hate C++ so much. I spent most of the day going over my QuickFix based FIX engine. Don't get me wrong, I love QuickFix. It's fast, reliable, and best of all, the price is right. However, its core is written in unmanaged C++ and it is darn near impossible to figure out what's going on with it. It's almost as if the folks that developed C++ way back when decided that obfuscation was a programming best practice and made it as easy as possible for the programmer to achieve. There's so many darn ways to do the same thing in C++ and it seems like the average C++ developer just can't resist the invitation.
Why, for instance, do I have to always look in two places (the *.h file and the *.cpp file) to find where the developer might have hidden the particular function I'm looking for? What's the deal with all the different intermediate files and compilation target options? I don't care if it's a *.lib or a *.dll, I just want it to work. And don't get me started on compiler switches. I've spent too damn many days tearing my hair out trying to flip the right compiler switch to get someone else's framework to compile in my environment. Of course, C# has taken care of all of this nonsense. Working with someone else's code base is trivial. Just download the source, add the project to your own and bingo, there you go (well, as long as they haven't forgotten to remove any dependencies to their internal packages, which often happens, what are you gonna do?)
Any way, that's my rant for the night.
Thursday, June 28, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment