Jesse Liberty, author of one of my favorite books (Clouds to Code) gives an overview of "My" in Visual Basic 2005
Blurb copied using the cool "Blog This" link on the ondotnet pages :)
Rapid Application Development with VB.NET 2.0 by Jesse Liberty -- For a couple of years now, Jesse Liberty been touting the Microsoft endorsed-sentiment that it really doesn't matter if you program in C# or in VB.NET, since both are just syntactic sugar layered on top of MSIL (Microsoft Intermediate Language, the true language of .NET). That appears to be changing a bit with Whidbey. Jesse Liberty investigates the new My object in VB.NET 2.0.
Comments
- Anonymous
August 04, 2004
Jesse ends the article with this:
"VB 2 has taken a dramatic lead in Rapid Application Development with the My object. This raises the question of why this facility is not available in C#. Unless there is a clear performance penalty in using the My object (I've not tested that yet) there is no reason to turn our C# noses up at anything that makes programming easier; after all, the more that is provided by the framework, the more we can concentrate on designing and building the application."
Yes, I agree that the My keyword does improve RAD, but does it really add anything new? It seems more like a bunch of scattered methods aliased in one place, and managed methods, too. My.Computer, for example, seems to just pull all the computer related fields from the Environment class. If it was a new set of managed features that encapsulated previously unmanaged functions in the Windows API, I would consider it to be more like a new feature. A C# programmer could encapsulate the functionality in a class and make their own "My" class which would provide equal RAD, plus the time it took to make it, but the developer would only have to make it once. Hats off to the VB.NET for this intuitive feature, but I don't really think it gives VB.NET any bragging rights. I guess it's kind of like the With statement in VB.NET, it's an exclusive feature, but not one that all C# developers are jumping to have because it doesn't add any new features, it's just a time saver. For the record though, I don't profess to know everything about the My keyword, so if I said something incorrect or sound like a baffling fool, please point it out.
P.S. I'm not trying to start a language war, I just wanted to express my opinion. :) - Anonymous
August 04, 2004
P.P.S. I concur that Jesse Liberty is a great author. Programming C# is one of the finest programming books I've read. - Anonymous
August 04, 2004
The comment has been removed - Anonymous
August 04, 2004
The comment has been removed - Anonymous
August 11, 2004
Just a quick note to thank you all for your kind comments You can find out more about my articles and books on my web site ( http://www.LibertyAssociates.com ) - just click on books and resources.
I agree that my is nothing more (and nothing less!) than a set of convenience wrappers, but convenient they are. You can do the same thing for yourself in C#, or you can use the VB.NET library from C#, but neither is as easy as just using the My objects in VB.NET.
Thanks.
-j