Wednesday, 25 January 2017

Blown away by Visual Basic

I've been in a stuck phase with my regular projects so I thought it could be funny to write a roguelike (what else?) using Visual Basic, you know, as a joke.

The current version of VB is something I did not expect. It's no longer that old, dumb language where you wrote code for Windows forms. It's a cool programming language built on top of a procedural past, but somehow seamlessly includes modern features (class being possibly the most important). Everything seems to work smoothly so you start to wonder why C++ can't be like this.

The only strange thing is how VB is managing resources. The reference/value system is automatic, some things are always references and others are value types. I guess it works somehow.

There is a problem with Windows console project which is that it's really slow. I think debug mode has something to do with it, but it should be faster. However I've found out that when you set the color of a character it's possibly the slowest thing you can do, so when you draw the level you can set the color (character and/or background) only when it changes.

The syntax of VB is quite verbose which I like personally. It's easy to write code that doesn't really need comments to understand what it is. The language doesn't seem to have ambiquity that C++ has. For example Sub never returns anything, but Function always does.


Brian MacKay said...

Yeah, VB.NET is actually almost exactly the same thing as C#. However, some time ago it lost the fashion war, and while C# tipped, VB.NET lost many of its supporters.

There are few technical reasons for the VB hate, aside from the fact that many VB.NET devs come from a VB past, and might carry certain baggage with them. C# devs also make ~$10k a year more.

graspee said...

One small problem of using vb rather than c# is let's say you decided you needed to -borrow- some code from somewhere... Suddenly you need to translate it all into vb instead of just pasting it in. Horror!

Brian MacKay said...

That is true, although: