4 ms·
This is very foreign to me, and I'm not a VB hater. I spent a long time working in a codebase that was half C# and half VB.NET, and after a couple years I coul
by ripley12 6y ago
This is very foreign to me, and I'm not a VB hater.
I spent a long time working in a codebase that was half C# and half VB.NET, and after a couple years I could switch between the two without thinking. VB has slightly more verbose syntax but that's about it, they're pretty interchangeable.
I don't hate `Dim foo As Boolean = True` but I wouldn't say it's more simple and readable than `bool foo = true;`.
- memsom 5y agoI did this a number of times. I started working on a VB.Net source base around 2007 and started to introduce C# as soon as I could, then next job in 2013 was also a WinForms app that embedded some WPF and used mainly VB.Net and some C#. I have to say, C# feels a lot more productive for me. I can switch between C# and VB.Net easily, but some of the stuff VB.Net does makes no sense. The 2007 project was a mess when I inherited it - the contractors who wrote it were based in India, and the code looked like a VB6 project. They had not turned on option explicit or option strict. They did not understand how events or event handlers worked - they added handles clauses to methods then assigned a variable with the current instance to make the events happen. It was bizarre. They also did a lot of horribly hacky things because all the variables were basically being treated as variant. There was even a bit of code where they had a select case statement where a Boolean variable was being used as a case... and I mean it was doing a select case on and integer, and one of the cases was a Boolean variable. So it depended on what that was set to as to what the case did. I turned on option strict and explicit, took a deep breath, and fixed the hundreds of errors. It was BRUTAL! I'm not saying this is something that is an issue with VB, that was down to the programmers not being trained properly and making some very bad decisions. But in C# it would have been very hard to make the same mistakes. By the time I left the 2013 job in 2018, I had divorced myself from almost all of the VB.Net code and I swore I would never touch VB again. So far, so good.
- ocdtrekkie 6y agoIt's possible it has a "native language" effect to me. Like how if I want to speak another language, say French, I think what I am trying to say in English and then translate. VB syntax is well solidified in my head as what I am trying to do... and in most cases when working with any other language, I end up going "okay, so how is Select Case formatted in this language?" I'm not saying VB is the best language, just that it's the one I find the fastest and most comfortable for me to work in.
- gregmac 6y agoI did the same, but based on the code style we used, more like `Dim foo = True` vs `var foo = true;` Honestly, because of how much VisualStudio auto-completes code, the biggest practical difference that cause me grief was semi-colons: spend a day working in one language, and spend the next day constantly getting the other language wrong. I remember back in maybe C#5 days there were somethings that I thought VB was nicer for (though I can't remember or find what they were now), but spending the last years working with modern versions (C#7.3 or C#8) there's nothing at all I miss from VB.