Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Celebrity Deathmatch (VB.NET vs C#)

Celebrity Deathmatch (VB.NET vs C#)

Scheduled Pinned Locked Moved The Lounge
csharphtmlcssvisual-studio
80 Posts 24 Posters 53 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Nemanja Trifunovic

    AspDotNetDev wrote:

    Maybe "End Sub" makes the code easier to read to somebody not initiated with the language, but it doesn't make the code any easier to write

    Which is a reasonable trade-off. You write code once and read it many times. Besides, with any decent editor, it is a non-issue.

    AspDotNetDev wrote:

    if (true)
    {

    I see unnecessary and confusing symbols here. For instance in Go, it would be something like:

    if true {

    Or (even better) in ML:

    if true then

    utf8-cpp

    A Offline
    A Offline
    AspDotNetDev
    wrote on last edited by
    #19

    Nemanja Trifunovic wrote:

    You write code once and read it many times.

    By that same reasoning, you learn a language once (well, can take a while for things to sink in) and you can develop software for many years based on that knowledge. It is faster to read "{}" than "Then End If", so why not go for the faster version since it is the one that will lead to the least overall time spent reading if-statements?

    [WikiLeaks Cablegate Cables]

    P N 2 Replies Last reply
    0
    • A AspDotNetDev

      Indeed. Visual Studio has VB.NET Quirks [see above] Better? :rolleyes:

      [WikiLeaks Cablegate Cables]

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #20

      AspDotNetDev wrote:

      Visual Studio has VB.NET Quirks

      Oh, Zarquon, no... VS' VB editor keeps deleting stuff; I have to be very careful when I do certain things. I'd give a example, but the wife says that dinner is ready.

      A 1 Reply Last reply
      0
      • C cechode

        i'm not a vb guy anymore but when i was i LOVED exit on first failed step. ( instead of nested if's )

            Select Case False
                Case Step1()
                Case Step2()
                Case Step3()
            End Select
        

        cant do that in C#

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #21

        Much like C, but C# semi-fixed that little problem. C# also doesn't have macroes like C, but VB has to continue to support them.

        1 Reply Last reply
        0
        • A AspDotNetDev

          There hasn't been a good "why language X sucks and language Y is better" thread in a good while, so I thought I'd start one. Unlike most, however, this one has rules. I will post a reason C# is better than VB.NET and somebody reply with a reason VB.NET is better than C#. I (or somebody else) will then reply to that message stating another reason C# is better. And so on. Also, you must show code examples (when appropriate). I'll start. C# Is Less Verbose

          Public Sub Something()
          ' VB.NET...
          End Sub

          public void Something()
          {
          // C#...
          }

          You're turn (post why VB.NET is better than C#). :)

          [WikiLeaks Cablegate Cables]

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #22

          VB has IsNot.

          A 1 Reply Last reply
          0
          • P PIEBALDconsult

            AspDotNetDev wrote:

            Visual Studio has VB.NET Quirks

            Oh, Zarquon, no... VS' VB editor keeps deleting stuff; I have to be very careful when I do certain things. I'd give a example, but the wife says that dinner is ready.

            A Offline
            A Offline
            AspDotNetDev
            wrote on last edited by
            #23

            PIEBALDconsult wrote:

            I'd give a example, but the wife says that dinner is ready.

            Yeah, I'd come up with some better examples, but I've been at work a couple hours past leaving time already.

            [WikiLeaks Cablegate Cables]

            1 Reply Last reply
            0
            • P PIEBALDconsult

              VB has IsNot.

              A Offline
              A Offline
              AspDotNetDev
              wrote on last edited by
              #24

              C# Has !=

              if (x != null) { /* xify */ }

              [WikiLeaks Cablegate Cables]

              P 1 Reply Last reply
              0
              • A AspDotNetDev

                Perhaps I should have said "C# Is More Concise". :rolleyes: But kudos to you for bringing up the counter point that VB.NET is more expressive. I think, however, that it's expressive in areas which do not require expressiveness. Maybe "End Sub" makes the code easier to read to somebody not initiated with the language, but it doesn't make the code any easier to write (you would have to know the "End Sub" in advance, so it's not expressing anything until you write it yourself). Of course, intellisense adds "End Whatever" for you, which brings me to my counter point: If-Statements Are Easier To Type in C# Supposing you have a code block and you want to surround it with an if-statement. In VB.NET, you must type "End If" in full:

                If True Then
                ' Code Block.

                If you press ENTER after "Then", the "End If" will be added in the wrong place. Instead, you can go to the bottom of the code block and type "End If". In C#:

                if (true)
                {
                // Code Block.

                All you have to type is "}" and the code auto-indents nicely. Along those same lines, C# waits until you type the closing brace... VB.NET is a little eager and indents the code before you need it to.

                [WikiLeaks Cablegate Cables]

                H Offline
                H Offline
                Henry Minute
                wrote on last edited by
                #25

                AspDotNetDev wrote:

                If you press ENTER after "Then", the "End If" will be added in the wrong place. Instead, you can go to the bottom of the code block and type "End If". In C#:

                That is an intellinonsense/Editor feature NOT a language feature.

                Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.

                A 1 Reply Last reply
                0
                • H Henry Minute

                  AspDotNetDev wrote:

                  If you press ENTER after "Then", the "End If" will be added in the wrong place. Instead, you can go to the bottom of the code block and type "End If". In C#:

                  That is an intellinonsense/Editor feature NOT a language feature.

                  Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.

                  A Offline
                  A Offline
                  AspDotNetDev
                  wrote on last edited by
                  #26

                  Well, part if it is an intellisense/editor feature. The whole having to type "End If" is part of the language though. And I'm not excluding things that are due to the editor. A clever enough editor would allow me to type in C# and convert it to VB.NET as I type... and it would apply a filter so that I would see C# when the underlying code is VB.NET. :rolleyes:

                  [WikiLeaks Cablegate Cables]

                  1 Reply Last reply
                  0
                  • A AspDotNetDev

                    Nemanja Trifunovic wrote:

                    You write code once and read it many times.

                    By that same reasoning, you learn a language once (well, can take a while for things to sink in) and you can develop software for many years based on that knowledge. It is faster to read "{}" than "Then End If", so why not go for the faster version since it is the one that will lead to the least overall time spent reading if-statements?

                    [WikiLeaks Cablegate Cables]

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #27

                    Yeah, the "C way" is better. It's much more flexible. See here for an example.[^] Also, several times I have changed an if to a while -- in VB you have to change both ends. X| Plus, using more symbols and fewer keywords makes C somewhat less Anglo-centric.

                    modified on Monday, March 28, 2011 11:52 PM

                    A N 2 Replies Last reply
                    0
                    • P PIEBALDconsult

                      Yeah, the "C way" is better. It's much more flexible. See here for an example.[^] Also, several times I have changed an if to a while -- in VB you have to change both ends. X| Plus, using more symbols and fewer keywords makes C somewhat less Anglo-centric.

                      modified on Monday, March 28, 2011 11:52 PM

                      A Offline
                      A Offline
                      AspDotNetDev
                      wrote on last edited by
                      #28

                      PIEBALDconsult wrote:

                      in VB to have to change both ends

                      I forgot about that! I ran into that today, actually. The most annoying one for me is "Function"/"Sub". Why the heck should I have to annotate that difference? They're both methods. Let the bloody compiler figure out if it returns something or not. I find it strange that VB.NET doesn't have "Begin Grouping" and "End Grouping" rather than parentheses. :rolleyes:

                      PIEBALDconsult wrote:

                      Plus, using more symbols and fewer keywords makes C somewhat less Anglo-centric.

                      Good point!

                      [WikiLeaks Cablegate Cables]

                      P 1 Reply Last reply
                      0
                      • A AspDotNetDev

                        C# Has !=

                        if (x != null) { /* xify */ }

                        [WikiLeaks Cablegate Cables]

                        P Offline
                        P Offline
                        PIEBALDconsult
                        wrote on last edited by
                        #29

                        Which ain't the same thing.

                        _ A 2 Replies Last reply
                        0
                        • P PIEBALDconsult

                          Which ain't the same thing.

                          _ Offline
                          _ Offline
                          _Damian S_
                          wrote on last edited by
                          #30

                          IsToo... IsNot... rofl... :laugh:

                          Reminiscing just isn't what it used to be!! If you like cars, check out the Booger Mobile blog | If you feel generous - make a donation to Camp Quality!!

                          1 Reply Last reply
                          0
                          • A AspDotNetDev

                            Nemanja Trifunovic wrote:

                            You write code once and read it many times.

                            By that same reasoning, you learn a language once (well, can take a while for things to sink in) and you can develop software for many years based on that knowledge. It is faster to read "{}" than "Then End If", so why not go for the faster version since it is the one that will lead to the least overall time spent reading if-statements?

                            [WikiLeaks Cablegate Cables]

                            N Offline
                            N Offline
                            Nemanja Trifunovic
                            wrote on last edited by
                            #31

                            AspDotNetDev wrote:

                            It is faster to read "{}" than "Then End If",

                            Kind of. End If closes the block after If and that's it. To get what } does you need to be aware of the scope - sometimes even to scroll up a couple of pages. Sure, a good editor helps, but as far as a language goes I like End If better.

                            utf8-cpp

                            A P 2 Replies Last reply
                            0
                            • P PIEBALDconsult

                              Yeah, the "C way" is better. It's much more flexible. See here for an example.[^] Also, several times I have changed an if to a while -- in VB you have to change both ends. X| Plus, using more symbols and fewer keywords makes C somewhat less Anglo-centric.

                              modified on Monday, March 28, 2011 11:52 PM

                              N Offline
                              N Offline
                              Nemanja Trifunovic
                              wrote on last edited by
                              #32

                              PIEBALDconsult wrote:

                              See here for an example.[^]

                              Would you double-check that link? I saw nothing related to your arguments there (using Chrome 10 on Fedora Linux).

                              PIEBALDconsult wrote:

                              Plus, using more symbols and fewer keywords makes C somewhat less Anglo-centric.

                              Meh, as a Cyrillic-writing Serbian I'll take Anglo-centric any time over cryptic symbols. In fact, my ideal language would have no operators at all - not even mathematical ones.

                              utf8-cpp

                              A P 2 Replies Last reply
                              0
                              • N Nemanja Trifunovic

                                AspDotNetDev wrote:

                                It is faster to read "{}" than "Then End If",

                                Kind of. End If closes the block after If and that's it. To get what } does you need to be aware of the scope - sometimes even to scroll up a couple of pages. Sure, a good editor helps, but as far as a language goes I like End If better.

                                utf8-cpp

                                A Offline
                                A Offline
                                AspDotNetDev
                                wrote on last edited by
                                #33

                                Very good point. Though, if the code is written in small enough methods and the editor is good enough (like Visual Studio), clicking on a closing curly brace will highlight the corresponding opening curly brace and you can see it without scrolling. If the code is not small enough, then you'd have to scroll anyway in either language and you could easily get lost. Come to think if it, would be a neat IDE feature if you could right click on "}" or "End If" and select "Go To Start".

                                [WikiLeaks Cablegate Cables]

                                1 Reply Last reply
                                0
                                • P PIEBALDconsult

                                  Which ain't the same thing.

                                  A Offline
                                  A Offline
                                  AspDotNetDev
                                  wrote on last edited by
                                  #34

                                  Ah. Right you are.

                                  [WikiLeaks Cablegate Cables]

                                  1 Reply Last reply
                                  0
                                  • N Nemanja Trifunovic

                                    PIEBALDconsult wrote:

                                    See here for an example.[^]

                                    Would you double-check that link? I saw nothing related to your arguments there (using Chrome 10 on Fedora Linux).

                                    PIEBALDconsult wrote:

                                    Plus, using more symbols and fewer keywords makes C somewhat less Anglo-centric.

                                    Meh, as a Cyrillic-writing Serbian I'll take Anglo-centric any time over cryptic symbols. In fact, my ideal language would have no operators at all - not even mathematical ones.

                                    utf8-cpp

                                    A Offline
                                    A Offline
                                    AspDotNetDev
                                    wrote on last edited by
                                    #35

                                    Nemanja Trifunovic wrote:

                                    my ideal language would have no operators at all - not even mathematical ones

                                    Your wish is my command. :)

                                    [WikiLeaks Cablegate Cables]

                                    1 Reply Last reply
                                    0
                                    • N Nemanja Trifunovic

                                      PIEBALDconsult wrote:

                                      See here for an example.[^]

                                      Would you double-check that link? I saw nothing related to your arguments there (using Chrome 10 on Fedora Linux).

                                      PIEBALDconsult wrote:

                                      Plus, using more symbols and fewer keywords makes C somewhat less Anglo-centric.

                                      Meh, as a Cyrillic-writing Serbian I'll take Anglo-centric any time over cryptic symbols. In fact, my ideal language would have no operators at all - not even mathematical ones.

                                      utf8-cpp

                                      P Offline
                                      P Offline
                                      PIEBALDconsult
                                      wrote on last edited by
                                      #36

                                      Fixed, thanks.

                                      A 1 Reply Last reply
                                      0
                                      • A AspDotNetDev

                                        PIEBALDconsult wrote:

                                        in VB to have to change both ends

                                        I forgot about that! I ran into that today, actually. The most annoying one for me is "Function"/"Sub". Why the heck should I have to annotate that difference? They're both methods. Let the bloody compiler figure out if it returns something or not. I find it strange that VB.NET doesn't have "Begin Grouping" and "End Grouping" rather than parentheses. :rolleyes:

                                        PIEBALDconsult wrote:

                                        Plus, using more symbols and fewer keywords makes C somewhat less Anglo-centric.

                                        Good point!

                                        [WikiLeaks Cablegate Cables]

                                        P Offline
                                        P Offline
                                        PIEBALDconsult
                                        wrote on last edited by
                                        #37

                                        AspDotNetDev wrote:

                                        "Function"/"Sub".

                                        Yeah, and class/module too.

                                        1 Reply Last reply
                                        0
                                        • C cechode

                                          this would be a linq version

                                                  (from f in new List<Func<bool>>() { Step1, Step2, Step3 }
                                                   where !f()
                                                   select 0).FirstOrDefault();
                                          

                                          but you are still limited to the same function signature in the vb version it could be

                                          case step1(mystring)
                                          case step2(myint, mystring)
                                          .....

                                          modified on Monday, March 28, 2011 6:56 PM

                                          A Offline
                                          A Offline
                                          AspDotNetDev
                                          wrote on last edited by
                                          #38

                                          I figured out a shorter version that makes use of LINQ. I posted a tip/trick about it.

                                          [WikiLeaks Cablegate Cables]

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups