Every so often, while teaching either VB.NET or C# a student will pull me aside and ask me, “ok, just between us two, what language should I learn?” Well, I just wrote a book on the differences and similarities of both languages so I start by recommending my book (hey, I’ve got to feed my family), then I start telling them some of the differences and similarities of both, and how they should really learn both, and focus on the foundation classes instead of the languages.
People are usually satisfied with that answer. But, when I get back home, and the curtains are shut, and the door is locked, and I boot up my machine and anxiously wait for VS.NET to launch, and finally see that New Project… dialog, then what? What language do I really choose?
OK, you are going to accuse me of being a tease, but the answer is I am not even sure which language to pick and I’ll tell you why. Each language has things that annoy me so much about them that they keep me from fully committing to them. So here are my main pet peeves for each.
Intellisense, uh um, how do I put this, stinks! (I am ommitting stonger words in fear that kids will read this.) I hate how intellisense does not sync-up in C#, and how you have to compile in order for it to finally sync-up. I thought at first that it would not upset me so much, after all a great DM instructor like me (being sarcastic here all you Wintellect lovers) should have System.Runtime.Serialization.Formatters.Binary.BinaryFormatter memorized, but c’mon can’t we use up a few more cycles doing a compile rather than parsing in order to get good intellisense? VB does a real nice job at this. Whenever I want to learn how to do something new, I automatically use VB, the intellisense is wonderful.
VB also has a nice feature for overriding methods, and implementing interfaces. Yes I know C# has that implement interface wizard, but it takes about five clicks to get there whereas VB.NET makes interface methods available right away through the editor’s toolbar. I haven’t found an easy way to override methods from C#. VB.NET lists the methods in the editor’s toolbar and all you have to do is select the method and the wizard adds the override for it. I know, you are thinking, Intellisense stops you from using the language, all I have to say to that is use VB.NET for a little while, its intellisense is addictive. And to make it worse, sometimes intellisense in C# makes it look like you’ve done the wrong thing until you re-compile, so you waste time thinking about how to fix lines that don’t need fixing.
The main thing that keeps me from using VB.NET all the time is a major shortcoming that is not related to editor features, it is actually a language feature. It has to do with interfaces. When you inherit your class from a base class and the base class implements an interface, it is impossible in VB to re-implement the interface. The only way that you can re-implement a method in an interface is if the author of the base class made the implementation method Overridable. I’ve already found several cases, with collection classes and remoting classes in which overriding the way the interface is implemented in the base is required and VB does not allow you to re-implement the interface. In C#, I can easily re-implement the interface in the derived class and override only the methods I care about while leaving the base implementation intact for the others. That is nice!
I have other pet peeves but I’ve run out of time to blog today, so I’ll probably list more later.
Tell me what language you’ve decided to use and why.