Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

C# versus Visual Basic

  • 12-05-2015 12:37am
    #1
    Registered Users, Registered Users 2 Posts: 216 ✭✭


    I have often written my programs in work in both, for various reasons. Coming from a high-performance (by which I mean: requiring low-level optimisations) C++ originally, I learned C# first and then Visual Basic. I'm aware that C# postions are more numerous and command a higher average salary, but what I want to focus on here is the languages in and of themselves.

    Basically, I've encountered the perception that Visual Basic is a poorer language than C#. Less professional, modern, performant. However having written multiple applications in both I cannot see a reason for this. They both compile to CIL, in some cases one is more directly similar to the CIL code, they both expose similar portions of the CLR's capabilities (although even combined it's still not all of it, there are some things only possible in raw CIL).

    Really, I haven't met much you can't do in both. Since C#4 and VB 10 they've only gotten more similar. Is there any basis for this judgement of Visual Basic other than the legacy of classical VB and the poor quality code it lead to, i.e. is VB.Net being judged by its predecessor?


Comments

  • Registered Users, Registered Users 2 Posts: 9,211 ✭✭✭Royale with Cheese


    Have been writing .Net for nearly 5 years. Most of that was c# but I did work for over a year developing for a vb.net application. The majority of the devs in that place shared the same opinion and wanted to stay as far away from it as possible. Not many of them could tell you why though, they just took one look at the syntax and decided they had no interest. I wasn't involved in the low level architecture and performance of the system so couldn't really answer those questions, but I didn't come across anything that caused me pain that would have been easily solved in c#.


  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    It's getting closer, it used to be that things like Yield didn't exist, but more and more features are appearing in VB. C# is the primary language, (after F# arguably...featurewise) and VB will probably lag behind, as it does slightly in C#6.

    https://github.com/dotnet/roslyn/wiki/Languages-features-in-C%23-6-and-VB-14

    If you are talking about optimisation, unsafe and checked blocks only exist in C#.


  • Registered Users, Registered Users 2 Posts: 2,793 ✭✭✭John_Mc


    For me it's as simple as the syntax not being as clean and generally being longer to write/read. I would image that a C# application that's well written will be more or less the same in terms of performance as the same application written to an equal standard using VB.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    VB, from about version 4, had been making a slow move from being a procedural based language to a more object orientated one. By it's last iteration, VB6 (which really was more a VB5.1) is was still ultimately a procedural language, with some object orientation thrown in.

    Java was all the rage back in the nineties. So much so that MS went and developed Visual J++. There were numerous problems with it, not least of all that Sun sued the crap out of MS for copying Java. As a result Visual J++ quietly died somewhere out of view.

    In comes DotNET. With it they introduced C# (which essentially is what Visual J++ should have been) as their new flagship language. However, you still had an army of VB developers (myself included) out there. So VB.net was introduced, finally becoming object orientated.

    Problem is that it was too much of a jump for many VB developers, or more correctly it was almost as easy to get into existing OO languages rather than continue with some iteration of VB that really didn't have much in common with VB6- and no non-VB developer would be likely touch it to begin with.

    I know, when I eventually needed to shift into DotNet, I made a conscious decision to learn C# (but also because it was ironically easier to go from Java to that, than VB6 to VB.net) and ignore VB.net.

    So with this lukewarm start, while many do use it nowadays, it pales in popularity compared to previous versions of VB.


  • Registered Users, Registered Users 2 Posts: 216 ✭✭AnLonDubh


    Giblet wrote: »
    https://github.com/dotnet/roslyn/wiki/Languages-features-in-C%23-6-and-VB-14

    If you are talking about optimisation, unsafe and checked blocks only exist in C#.
    Thanks for the link, that sums it up nicely. I forgot about the unsafe code, Ive only used it once for kernel32 calls, all that P/Invoke stuff is a rabbit hole.

    I remember VB used to have an advantage with COM interop, but C# getting named and optional arguments, as well as a dynamic type changed that.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    I know, when I eventually needed to shift into DotNet, I made a conscious decision to learn C# (but also because it was ironically easier to go from Java to that, than VB6 to VB.net) and ignore VB.net.

    So with this lukewarm start, while many do use it nowadays, it pales in popularity compared to previous versions of VB.

    I think a lot of houses went to vb.net from vb6 and pretty much tried to continue writing code as they always had, not really exploiting the OO capabilities of the language. Perhaps this has something to do with the view the VB is weaker (personally I think the syntax is ugly as hell). I think they should have gone the C# route as the shift would have helped them adopt the new paradigm, instead of trying to continue as usual.


Advertisement