The latest releases of C# and VB are packed full of keystroke-saving innovations. This seems to be one of the things Microsoft is most proud of. We have “nice, terse” features1, which will “really improve productivity and reduce the amount of code we need to type”2.
A good example is automatic properties (all examples will be in C#):
public class Plant
{
public string GenericName { get; set; }
public string SpecificName { get; set; }
public string CultivarName { get; set; }
public string VarietyName { get; set; }
public string SubSpecificName { get; set; }
}
See how few keystrokes are required? You can read more about this by going to Bart De Smet’s blog.
Well, that’s not all. We also have, for example lambda expressions, which reduce anonymous methods down to their bare bones:
// Anonymous method
MyDel del = delegate(int x) { return x + 1; };
// Lambda expression
MyDel le = x => x + 1;
You can see how there will be fewer keystrokes with this innovation (and there are plenty more where that came from). This all goes to help the new editions of C# and VB to have a life of their own, but Microsoft seem to be encouraging developers to participate in their own version of the old Obfuscated Perl contest or International Obfuscated C Code Contest.
The mania for productivity, if it continues, could potentially lead to beautifully elegant code that only the author of that code can read. I can see that Microsoft has developers’ interests at heart, however, making them even more valuable and efficient workers than they already are. I’ll be paying attention to developments in this area anyway.
