Ok, maybe the topic is a little tough but the general idea is pretty sound. Recently I had the pleasure of helping someone on DIC with a VC++ project and decided to whip up something in the latest VS 2005. Now granted much my experience in VC++ was pre 2005 CLI so I was completely blown away with the syntax changes they made using the Common language Infrastructure (CLI) to VC++ 2005. I fully understand what they are attempting to do and I think it is wonderful. However, the syntax is becoming very verbose and very cryptic. I thought the idea was to abstract to a higher level and actually simplify using objects. That is what C# is doing, that is what VB is doing and same with ASP.NET etc. Here is an example of what I am talking about….
array<array<int>^>^ arr = gcnew array<array<int>^>(2);
For those of you who are not VC++ gurus but know your way around C++ understand this? And what is with all those Carets? Well in the language most people refer to the first one as a Caret and additional ones as “hats”. They basically do the same thing as the old asterisk did, but are for managed objects. In our example I think there are way too many of them. I have seen examples where they have to even use a typedef just to shorten up the statements so they can be used!
The example essentially declares a jagged array (array of arrays) of type int but on the managed heap so that it can be garbage collected. Fine and dandy but changing things like “new” to “gcnew” and changing asterisks to hats is crazy! Then to write out “array” to say you want an array rather than using a few symbols is also a bit of overkill here. In the old days roughly the same thing would be done simply using…
int[][] arr = new int[][];
Now I fully understand the theory behind managing classes on a managed heap for garbage collection and all that, but the syntax here is really becoming way too verbose. Studies have shown that increasing the amount of syntax used and thus causing the programmer to write more dramatically increases the likelihood that the programmer is going to introduce an error just by typing it.
I think that perhaps Microsoft should look at VC++.NET and think about simplifying its syntax, even at the expense of losing some backward compatibility because I figure if this trend continues more people will leave VC++ and opt for C# which can be more readable. Certainly it is not going to be a beginner language and never would I recommend it to a beginner. Now granted C++ is still the fastest kid on the block but I believe at the expense of some straight forward readability and common syntax.
After a few articles on the subject of CLI and how it has changed in 2005 I can easily adapt, but god forbid the work the casual programmer would have to do just to get their mind around some of these changes. Personally I think it might be better to be a total newbie to this stuff than have learned the old ways and now forced to change our way of thinking.
But I am sure I will “manage” to wear this “hat” as well. 🙂