August 17, 2006

[XNA] Microsoft.VisualBasic Namespace

Right now, it's looking like C# is going to be the supported language for XNA.

Now, I can't say that I'm happy about that. One of the major reasons for the .NET Framework was to make all languages first-class citizens. C#'s ability to use unsafe code shouldn't give it preferential treatment for gaming.

That said, there's a high likelihood that we'll be able to hack a way to use VB 2005, provided we don't link in the Microsoft.VisualBasic namespace, and I'm actually okay with that. Why? Two reasons. First, most of what is in the namespace is old helper functions that are duplicated in the .NET Framework already. Second, I'm fine with working within the System namespace structure.

I don't need to use Len(str) when I can use str.Length() instead. I don't need Trim(str) when I can use str.Trim(). The only thing that most of the VB helper functions in the Microsoft.VisualBasic namespace buys us is an extra level of error checking by checking for strings and other objects being equal to Nothing. No offense, but if something is set to Nothing inside the game and we didn't set it to Nothing, something is definitely wrong to begin with and we need to be trying to find the root cause, not letting the function hide the error from us.

While we'll potentially be losing some helpers from Microsoft.VisualBasic.Devices, again, most have fairly close compatriots inside the System namespace.

I love VB, and will do whatever I can to make sure that XNA and VB find a way to work well together, but if getting my code onto the Xbox 360 means ditching a mostly-redundant namespace, I'm fine with saying "bye bye."

2 comments:

Tom said...

So does this mean you think we'll eventually see AAA games shipped written using .NET?

Michael Russell said...

There have already been a few AAA-quality titles that have been written in C# and shipped. You can find a list at TheZBuffer.com.

That said, there are also some downsides which I'm hoping to address in a coming post.