January 2005 Entries

Stupid questions...

So Andrea and I were talking on Friday about learning to cook and, in particular, how I used to really drive her nuts with stupid questions when I was taking my first culinary steps in the kitchen. Now, when I say “stupid questions,” I mean really stupid questions not “emperor’s new clothes” kind of stupid questions. The latter kind of stupid questions are understandable and have a certain aura of respectability. For example, while the question “Hey, honey, this recipe says that I need to ‘julienne’ the carrots. What does that mean?” might seem like a stupid question to someone who...

Singletons and Default Instances

In my previous entry, I described what default instances are but left open the question of why we're re-introducing them into the language. So let me spend a moment discussing that. A default instance is, more or less, an instance of the design pattern called a singleton. A singleton is a type that only ever has one instance (hence the "single" part of "singleton"). Forms are often an excellent example of singletons because there is usually only ever going to be one instance of the form (with the exception of less common situations like MDI windows). For example, you only need one...

Vote for Me!

Now I know that you're all saying to yourselves: "Paul, I read your blog religiously, I've bought your book, I've gone to all the talks you've given, I've listened to the .NET Rocks show you were on, I'm even considering getting your name tattooed across my... What else can I possibly do to show my love for you?"I'm glad you asked!My friends at Addison-Wesley let me know that my book, The Visual Basic .NET Programming Language, has been nominated for a Sys-Con Reader's Choice award! I'm up against some pretty stiff competition, so I urge everyone who liked my book...

Default Instances

Fresh off of writer's block, I thought I'd dive straight back into the sea of controversy and talk about a feature called "default instances." Default instances are a "new" feature in VB 2005 that is really the return of a very old feature, one that's been around for a long time. Now, the return of default instances has stirred some very passionate debate, but what I'm going to do is address this question in three separate entries. In this entry, I'm going to describe what default instances are at a technical level. In my next entry, I'm going to talk about what...

Feedback request on new warning

We've been internally discussing a new warning that we've added to VB 2005 and how we should treat it for upgrade, and I'd like to get some feedback from those people who have been using the beta or the community previews. A common error that we see is using a reference variable before it's been assigned a value. For example:Dim x As Collectionx.Add(10)This code will throw an exception because I forgot to create a new collection using New. In VB 2005, this code will produce the following warning:Variable 'x' is used before it has been assigned a value. A null...

Writer's block

When people haven't written a while they usually start off with some kind of apology like "sorry I haven't written in so long, but I've been doing xyz." My feeling is: blogs (with some exceptions) are strictly amateur hour, so no apologies are necessary for life intervening. That's just the way it is, and people should come to expect that from blogs - you get what you pay for.That said, I'd really like to say that I haven't been writing in a while because I've been busy, but that's not really it. The holidays took up a lot of time...