I like the way events feel in VB

Since I've joined the VB team, I've been trying to learn the language and the "culture" that befits VB programmers. Since everything is based on .NET, I can easily degrade this experience and write VB programs that are just syntax sugars over the CLR - but I've been trying to stay away from "doing things the .NET way" and figuring out what it means to "do things the VB way."

One of the things that I really like about the language is the coherence around events. I like that you specify events by saying:

      Private Sub WorkMethod( ... ) Handles SomeClass.SomeEvent

To me, it brings the event stuff close together in the source code - often times in other languages, you add an event handler at a location that could be far from the definition of the method that handles the event - and there is no syntatic annotation that indicates that a certain method is in fact handling an event.

I like the VB way because it makes it clear that WorkMethod() is handling SomeClass.SomeEvent - and you can read all of this on one line.

Of course, the downfall is that lines tend to be long - and I'm not used to the line continuation character thingy yet, so it's a bit of an annoyance when I have to scroll horizontally (I'm a believer of 80 columns - yes, I'm stuck in the DOS age 🙂

Comments (0)

Skip to main content