Last night i got a chance to see the new son james of one of my friends from school and work. He's all of 4 days old, but he's completely adorable and i wish the entire family a wonderful future.
I thought that while I was on the topic of cute, adorable new things that smell slightly like poo it might be a good time to talk about VB and to mention a feature that they have that really caught my attention recently. (i kid, i kid, VB isn't that new). I'm talking specifically of the new "My dot" feature. The name comes from the new system that VB has for providing you with many common conveniences when you type the in "My" followed by a dot.
The theory is quite sound. Specifically, the BCL frameworks are incredibly powerful and allow you to do may things, however they come with so much complexity and abstractions that finding out how to do very simple tasks is sometimes quite difficult. To help solve that the "My." system would wrap much of the complexity behind simple convenience classes that would allow you to have a one stop shop to both discover the environment and then perform common useful actions on it.
I come from a java background myself and I can attest to how difficult this kind of system can sometimes be. For example (and please tell me if I'm out of date or wrong) i recall that just creating an XML parser could be quite annoying at times. I had to create a DocumentFactoryBuilder which would produce a DocumentFactory which i could then parse a stream out of to get an actual Document. As a very OO minded developer I understood the model and I appreciated the power it gave me to drop in other parsers, to change parameters, and to dictate where i wanted to generate the XML document from. However, sometimes I just wanted to parse a file and i didn't like the hoops i had to jump through. Other areas where I felt the same were clipboard management and Drag-and-Drop. Both were areas that exposed an incredible amount of power to the programmer, but also made it quite confusing how to do a simple task.
I've heard similar things said about the BCL, and while I don't have have enough experience with it yet I can understand where people are coming from. However, rather than just sitting there commiserating with unhappy people the VB team decided to do something about it, and they came up with the "My." system (hereto referred as My.). 'My' is a special 'thing' in VB now that is somekind of an amalgam of a namespace and a type. Inside this typespace they've provided many convenient ways to access information that is relevant to you and to give you quick access to perform many simple operations without a lot of conceptual overhead involved.
Here's what the first view looks like:
as you can see it looks partially like a type with a few properties like "computer, application, user", and it looks partially like namespace with a nested namespace "Resources" (which I'll talk about at another time). If we expand down into the Computer property we can see useful ways to access things like audio or even the network:
How useful is that? If you just want to know if the network is available bam so easy. If you want to download a file, trivial. If you want to receive a notification when the system loses/gains network access, it's also provided. Every single thing in there is useful and allows me to do things without incurring the enormous overhead of learning the ins and outs of so many different APIs.
If i want to use the clipboard to simply push/pull an image, it's there:
Now it goes without saying that you can't do everything from here. That's not the point of My.. If you need to do more you can just use the actual BCL apis that My. sits on top of. However, if you're writing an app around a certain domain and you just need to do something simple in a different domain this allows you to do so while remaining focussed on what you're doing. Heck, I'd love my app to say "Welcome Cyrus" when it starts up, but I'd have no idea how to do that. With My. I could just use:
I think this idea is a fantastic one and i think VB developers are going to love it. I'm curious about some aspects of it, like whether or not it's extensible. But I'd imagine the VB team is going to see how people feel during beta1 and will use that feedback to drive the final feature.
I also think that C# developers are going to be asking why don't we have this feature. What do you think? Is this something you would want, or am i just being wowed with smoke and mirrors? Is this a model that all APIs should potentially strive for. A full robust API view that allowed you to do almost anything you would expect in that domain; and an extremely simplified wrapper view that exposed the most common types/operations/behaviors so you could quickly dive in and get what you wanted.
Edit: Adding example of what My.Computer looks like: