Hey, community.
This one might probably trigger some of you. But just a question that comes out of the blue: What are your thoughts on it?
I first learned programming back in the day with Visual Basic 2008. Nowadays, I can program with C#, Java, PHP and some other languages rather well (I’m no professional, though), but I often come back to Visual Basic, because I’m just so used to it. Even though it’s not that often, because I’m a Linux user.
But let’s say I need a small program for Windows real quick? VB.NET is gonna be my choice. Right now, I’m implementing a board game server + client for the game of go (also called baduk or wei’qi) and I’m making really good progress.
I personally think that people should just use what they want to use. I don’t get the hate for PHP and some other languages and I think this gate-keeping and god complex some developers have is really annoying. Makes me want to use VB.NET even harder.
I also don’t like to jump on board with every new and upcoming programming language or library, just to be cool.
I’d also like to emphasize that I’m not creating software for a living right now. I do have a small company for a little bit of freelance work, but that’s just money on the side that comes in by creating really small projects.
With
Option Strict On
and other reasonable accommodations, VB .Net isn’t really any worse than C#—just kind of sloppy and verbose. I’ve coded in worse. (And I think Mono supports it now, so you might be able to use it under Linux, too.)VB 6 / VB for Applications, on the other hand, is beyond awful and should probably be formally exorcised.
On Error Resume Next
is clearly the work of some malevolent supernatural being.(As for PHP, it draws a lot of flak because of things like the lack of a naming convention in its early days—it used to be that you couldn’t predict whether a function in the standard libraries was going to be named in snake_case or justsmashedtogether. It’s been more than 10 years since I last worked with the language, so I hope they’ve fixed that.)
FYI Mono is essentially dead now or at least no longer necessary as .NET 6 is open source and cross platform, so you can just use regular .NET on Linux now.
Eh, you can tell I haven’t spent much time worrying about .Net support on Linux for a while—there’s always some other language or system that I consider a better fit for the job. (In other words, I sit corrected, because standing would be too much effort.)
The bulk of my day to day work is with a legacy application written in vb.net, and I couldn’t agree more with your first paragraph.
First, of course, use whatever you’re comfortable with.
Second, a lot of that advice you see is about long-term development on large projects. Often you don’t know if a little side project is going to turn into something huge but it’d be nice to have started it in something that will be more easily maintainable down the line.
May I just ask how VB.NET code isn’t maintainable? Not attacking you here, just out of curiosity. My board game server and client together amount to multiple thousand lines of code, as they’re very feature rich and at the moment, it’s not really hard for me to maintain things. It’s not public yet, though. Still active development phase.
May I just ask how VB.NET code isn’t maintainable?
TL;DR: Lots of old code written by VB6/VBA programmers in the wild. It’s way more holistic than C-hacker-ish C# code.
Speaking from a bunch of legacy projects, you will likely encounter:
- Option Strict Off activated, so your type checking and IDE tools are half broken now.
- Global imports from anywhere to anywhere, proper namespacing is unheard of.
- Object everywhere, because Variant.
- On Error Resume Next everywhere, so you switch off and on exceptions while debugging.
- ByRef everywhere, because VB Classic is call by reference first.
- All declarations on top of a function, drastically increasing their scope, because, you guessed it, this is the only way in old VB.
- Code bases riddled with poor reimplementations of string methods using Mid. Actually, that’s a bonus, it’s very satisfying replacing those with one call to a string member.
- Multiple assignments to function name variable instead of return, making code harder to follow.
I’m currently maintaining a multi million line VB.NET code base, the foundations of which were hastily laid down by young and inexperienced devs realizing a business opportunity in the early 2000s. Lots of these out there in the enterprise world from what I hear and I think this is where there the language gets its reputation from. Sure, at its best it’s just C# with words in place of curly braces, but that’s only the case with well disciplined programmers (and even then, why not just use C#?). Option Strict is, well, just an option, and even the infamous
On Error Resume Next
is still usable in VB.NET to this day afaik. A lot more room for shooting yourself (or the next person reading your code) in the foot if you don’t know what to look out for.I was mostly thinking about PHP with that comment. Which has some serious issues with how modules from other files are included and general structure. It’s possible to write well organized PHP projects but it takes discipline, it doesn’t happen organically, and its really hard to fix once the project has grown significantly.
I haven’t used VB since
VB.NET
2003 so I hesitate to speak on that directly. Professionally I work across multiple OS’s and architectures so all .NET languages are kinda no-go’s. That’s where C++ really shines.It’s possible to write well organized PHP projects but it takes discipline, it doesn’t happen organically, and its really hard to fix once the project has grown significantly.
That applies to most languages, that you can write an awful unmaintainable mess. Especially when the project started by someone with little experience, or no knowledge about suitable design patterns.
Professionally I work across multiple OS’s and architectures so all .NET languages are kinda no-go’s. That’s where C++ really shines.
How about Java?
Professionally I work across multiple OS’s and architectures so all .NET languages are kinda no-go’s
.NET has had support for Linux, Mac and ARM for a while now.
Atari Basic was my very first programming language, so I grew up learning Basic. Having said that: I don’t see any reason why new software should be written in any Basic-dialect except for fun (the same kind of fun like writing a game engine in Ada) or because of legacy reasons. So programming on the C-64, or QBasic and DOS, a.s.o. all those are fun projects, kind of like reenactment of medieval knight fights.
In your case: If you feel comfortable using VB for your personal projects, then go ahead. But for me any variant of VB is awful, and this also applies to PHP. And in a perfect world we also wouldn’t use JavaScript.
Got it, but on the other hand (and as someone else commented): With the right settings, VB.NET can be en par with C#, for instance. They both compile to the same MCIL code, so it should really boil down to a matter of personal preference, right?
I feel that many people don’t know that and tend to think back to C64 Basic, etc. and just laugh it off.
I mostly use it for personal projects, yes. I also enjoy other “hated” languages like PHP and Java. To me, they’re just tools to accomplish a task. I also like to play the UNO reverse card: I personally hate projects that run with Electron, for instance. Such a waste of resources, things don’t integrate well into the DE, etc.
Got it, but on the other hand (and as someone else commented): With the right settings, VB.NET can be en par with C#, for instance. They both compile to the same MCIL code, so it should really boil down to a matter of personal preference, right?
I mean, you could also use C++/CLR. Please don’t. Because at some point people like me have to maintain it and they will hate every minute of that experience.
I feel that many people don’t know that and tend to think back to C64 Basic, etc. and just laugh it off.
I don’t know if people laugh it off because of the 8bit Basics, I think it’s more because of VB6. And AFAIR VB.net was made to make it easier for VB6-developers to switch to .net. The real programming language for .net was supposed to be C# and I guess some people at Microsoft also like F#.
I also enjoy other “hated” languages like PHP and Java
But Java is not a bad language per se; I actually enjoyed programming in Java more than C#. Java is hated because of its Enterprise-stuff. C# has managed to get a foot-hold in game development and is therefore cooler than Enterprisey-Java.
I also like to play the UNO reverse card: I personally hate projects that run with Electron, for instance.
I don’t see how that is a UNO reverse card :)
Thanks for the heads-up. 😀 It’s not that I consider VB.NET to be my favorite language. I just wanted to say that I don’t feel alright with all the “hate” that I’ve seen in the past when it comes to programming languages. I often see people ask what their first programming language should be and the “gatekeeping” answers are really annoying. Maybe gatekeeping isn’t even the right word…
You can just as easily creat those small apps with csharp.net so really it just comes down to preference. I personally don’t enjoy the syntax of VB though.
Yeah they both compile to the same CIL so performance isn’t an issue.
I feel like you just answered your own question of why people don’t like VB.NET and prefer C#. Per your own words you have two languages that are “just as good” except one of them needs settings adjustments or it’s not as good, and also has “alien” syntax which makes it harder for other developers to work on the code and makes it harder for you to move to other C-style languages (basically every currently popular language).
So if at best they’re “just as good”, then the obvious choice is C# which requires no settings change and has familiar syntax. Especially so if you can work in both just fine.
It’s not just some “god complex” thing, it’s mostly just practicality.
Ignore the weird tribalism over the languages other people prefer to use.
Just one thing to keep in mind about VB.Net, Microsoft considers it “done”. Active development is done, yhe language won’t receive any new enhancements anymore, so all the cool new C# features (like pattern matching) will not be back ported to VB.Net.
- No Use in modern software development
- Weird Ass Syntax
- Script Kiddie language.
- Abandoned by Microsoft
2/10
Background: Maintained legacy code for a handful of years.
Pros:
- They got generics syntax right
- Forms editor a bit less broken than for C#
- Better preprocessor, well, more powerful at least
- Explicit implementation of interfaces
- Better switch statement, though I think C# kind of caught up
- Some other advantages over C# from here I forgot
Cons:
- It is possible that Option Strict, Explicit and Infer aren’t activated in that legacy project, so you should run
- Includes a lot of VB classic stuff
- No unsafe mode
- Less null safe than C#
- Microsoft basically seems to have abandoned it
- Includes some bullshit, like XML literals
- No pattern matching
- Index operator() doesn’t read great
- Some other questionable design decisions from here I forgot
- It’s .Net, something that I’ve felt less and less enthusiastic about as times progressed and which has become sort of a symbol of tragic waste for me
I wrote a ton of vb6 in the 90s. Then vb.net 2003 in… Well that date. Then moved to c# after holding on for awhile.
My memories of that time:
- its higher mental load to do the right, safe thing in vb.net vs the same objective in c#.
- both early versions of both languages had really similar capabilities, as they both compiled to the same IL code targeting the same VM.
- these differences obviously moved apart as the years went by as the cost to innovate in 2 places is wasted effort… So language enhancements went into c#.
These days you might as well learn pascal as vb… If you want to know where to invest your time in learning i would suggest C#, java or golang for backend. Or typescript. Typescript is good.