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. The new GOTO Statement?

The new GOTO Statement?

Scheduled Pinned Locked Moved The Lounge
questionlinqhardwarealgorithmscollaboration
82 Posts 29 Posters 87 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.
  • S Offline
    S Offline
    sisnaz
    wrote on last edited by
    #1

    After coming down off of the "That's pretty cool" factor and as members on my team have increasingly been using anonymous methods, lambda expressions and new Func<> routines embedded in methods. The complexity (IMO) as increased significantly. I've begun to question this seemingly popular approach as; What's the difference between using embedded functions and a goto statement? It seems to me it's no different and just as difficult to follow and maintain. I'd be curious on other opinions of this practice.

    J R L N C 11 Replies Last reply
    0
    • S sisnaz

      After coming down off of the "That's pretty cool" factor and as members on my team have increasingly been using anonymous methods, lambda expressions and new Func<> routines embedded in methods. The complexity (IMO) as increased significantly. I've begun to question this seemingly popular approach as; What's the difference between using embedded functions and a goto statement? It seems to me it's no different and just as difficult to follow and maintain. I'd be curious on other opinions of this practice.

      J Offline
      J Offline
      Jason Hooper
      wrote on last edited by
      #2

      Can you give us an example?

      Jason

      1 Reply Last reply
      0
      • S sisnaz

        After coming down off of the "That's pretty cool" factor and as members on my team have increasingly been using anonymous methods, lambda expressions and new Func<> routines embedded in methods. The complexity (IMO) as increased significantly. I've begun to question this seemingly popular approach as; What's the difference between using embedded functions and a goto statement? It seems to me it's no different and just as difficult to follow and maintain. I'd be curious on other opinions of this practice.

        R Offline
        R Offline
        R Giskard Reventlov
        wrote on last edited by
        #3

        KISS

        "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me

        P 1 Reply Last reply
        0
        • S sisnaz

          After coming down off of the "That's pretty cool" factor and as members on my team have increasingly been using anonymous methods, lambda expressions and new Func<> routines embedded in methods. The complexity (IMO) as increased significantly. I've begun to question this seemingly popular approach as; What's the difference between using embedded functions and a goto statement? It seems to me it's no different and just as difficult to follow and maintain. I'd be curious on other opinions of this practice.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Yes, you can abuse lambda's and make a mess. You can abuse goto and make a mess. You can abuse boolean variables to simulate some forms of goto and make just as big a mess. You can abuse operator overloading and make a mess, and when James Gosling says you can't have operator overloading in Java, you can make just as big a mess with method overloading and virtual methods if you set your mind to it. You can abuse switch in atrocious ways in C and C++ (case goes pretty much anywhere, it doesn't even look like valid syntax but it is), which is like a goto where you don't even know for sure where it will go. You can abuse pretty much every aspect of a general purpose programming language.

          J M OriginalGriffO B E 6 Replies Last reply
          0
          • L Lost User

            Yes, you can abuse lambda's and make a mess. You can abuse goto and make a mess. You can abuse boolean variables to simulate some forms of goto and make just as big a mess. You can abuse operator overloading and make a mess, and when James Gosling says you can't have operator overloading in Java, you can make just as big a mess with method overloading and virtual methods if you set your mind to it. You can abuse switch in atrocious ways in C and C++ (case goes pretty much anywhere, it doesn't even look like valid syntax but it is), which is like a goto where you don't even know for sure where it will go. You can abuse pretty much every aspect of a general purpose programming language.

            J Offline
            J Offline
            Joan M
            wrote on last edited by
            #5

            You've just abused of your own post... and you've made a mess when you've painted some words in blue like links without being true links... :rolleyes:

            [www.tamautomation.com] Robots, CNC and PLC machines for grinding and polishing.

            1 Reply Last reply
            0
            • L Lost User

              Yes, you can abuse lambda's and make a mess. You can abuse goto and make a mess. You can abuse boolean variables to simulate some forms of goto and make just as big a mess. You can abuse operator overloading and make a mess, and when James Gosling says you can't have operator overloading in Java, you can make just as big a mess with method overloading and virtual methods if you set your mind to it. You can abuse switch in atrocious ways in C and C++ (case goes pretty much anywhere, it doesn't even look like valid syntax but it is), which is like a goto where you don't even know for sure where it will go. You can abuse pretty much every aspect of a general purpose programming language.

              M Offline
              M Offline
              Manfred Rudolf Bihy
              wrote on last edited by
              #6

              Amen to that!

              "With sufficient thrust, pigs fly just fine."

              Ross Callon, The Twelve Networking Truths, RFC1925

              1 Reply Last reply
              0
              • L Lost User

                Yes, you can abuse lambda's and make a mess. You can abuse goto and make a mess. You can abuse boolean variables to simulate some forms of goto and make just as big a mess. You can abuse operator overloading and make a mess, and when James Gosling says you can't have operator overloading in Java, you can make just as big a mess with method overloading and virtual methods if you set your mind to it. You can abuse switch in atrocious ways in C and C++ (case goes pretty much anywhere, it doesn't even look like valid syntax but it is), which is like a goto where you don't even know for sure where it will go. You can abuse pretty much every aspect of a general purpose programming language.

                OriginalGriffO Offline
                OriginalGriffO Offline
                OriginalGriff
                wrote on last edited by
                #7

                Yes, I agree. Every element of a language has it's use - even goto and var in C#- it's just that if you use them inappropriately you get less readable code instead of more. Personally, I find lambdas are useful in their place, but I avoid using them most of the time. var should be banned outside Linq!

                Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

                "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                P L S M B 10 Replies Last reply
                0
                • R R Giskard Reventlov

                  KISS

                  "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #8

                  God gave rock and roll to you. Rock and roll to you. Put it in the soul of everyone.

                  *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                  "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                  CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

                  P 1 Reply Last reply
                  0
                  • S sisnaz

                    After coming down off of the "That's pretty cool" factor and as members on my team have increasingly been using anonymous methods, lambda expressions and new Func<> routines embedded in methods. The complexity (IMO) as increased significantly. I've begun to question this seemingly popular approach as; What's the difference between using embedded functions and a goto statement? It seems to me it's no different and just as difficult to follow and maintain. I'd be curious on other opinions of this practice.

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

                    sisnaz wrote:

                    What's the difference between using embedded functions and a goto statement?

                    :~ How are they similar? One is a flow control statement and another is a scope for a function. Or am I missing something?

                    utf8-cpp

                    1 Reply Last reply
                    0
                    • S sisnaz

                      After coming down off of the "That's pretty cool" factor and as members on my team have increasingly been using anonymous methods, lambda expressions and new Func<> routines embedded in methods. The complexity (IMO) as increased significantly. I've begun to question this seemingly popular approach as; What's the difference between using embedded functions and a goto statement? It seems to me it's no different and just as difficult to follow and maintain. I'd be curious on other opinions of this practice.

                      C Offline
                      C Offline
                      CPallini
                      wrote on last edited by
                      #10

                      Bad 'software engineers' are to blame if goto has such a bad fame.

                      Veni, vidi, vici.

                      L 1 Reply Last reply
                      0
                      • P Pete OHanlon

                        God gave rock and roll to you. Rock and roll to you. Put it in the soul of everyone.

                        *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                        "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                        CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

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

                        Me and the boys will be playing all night.

                        1 Reply Last reply
                        0
                        • S sisnaz

                          After coming down off of the "That's pretty cool" factor and as members on my team have increasingly been using anonymous methods, lambda expressions and new Func<> routines embedded in methods. The complexity (IMO) as increased significantly. I've begun to question this seemingly popular approach as; What's the difference between using embedded functions and a goto statement? It seems to me it's no different and just as difficult to follow and maintain. I'd be curious on other opinions of this practice.

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #12

                          sisnaz wrote:

                          What's the difference between using embedded functions and a goto statement? It seems to me it's no different and just as difficult to follow and maintain. I'd be curious on other opinions of this practice.

                          :doh: A GoTo breaks the flow where as a embedded function becomes part of the flow. Here is some psuedo code to show you the difference

                          bool flag = GetFlag() //Embedded but the point is made elsewhere

                          if flag
                          GOTO: SomeLabel

                          EmbeddedMethod();

                          SomeOtherEmbeddedMethod();

                          OK, so this code will ONLY run the EmbeddedMethod if the flag is false. One would think in that case it will also run the SomeOtherEmbeddedMethod and here is lies the evil of GoTo. What if the EmbeddedMehtod is defined in the same manner using a GoTo? i.e.

                          bool flag = GetSomeOtherFlag()
                          if flag
                          GoTo: SomeOtherLabel

                          Now as a user when I am looking at the first code snippet I have to account for that extra GoTo that could happen. Maybe I must run some logic if the EmbeddedMethod runs. How do I ensure it in the most simple manner? Solution, Dont't use GoTo!

                          Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

                          S 1 Reply Last reply
                          0
                          • C CPallini

                            Bad 'software engineers' are to blame if goto has such a bad fame.

                            Veni, vidi, vici.

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #13

                            Bad Software languages breed bad software engineers....

                            Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

                            C 1 Reply Last reply
                            0
                            • OriginalGriffO OriginalGriff

                              Yes, I agree. Every element of a language has it's use - even goto and var in C#- it's just that if you use them inappropriately you get less readable code instead of more. Personally, I find lambdas are useful in their place, but I avoid using them most of the time. var should be banned outside Linq!

                              Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

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

                              Hear hear!

                              1 Reply Last reply
                              0
                              • L Lost User

                                Yes, you can abuse lambda's and make a mess. You can abuse goto and make a mess. You can abuse boolean variables to simulate some forms of goto and make just as big a mess. You can abuse operator overloading and make a mess, and when James Gosling says you can't have operator overloading in Java, you can make just as big a mess with method overloading and virtual methods if you set your mind to it. You can abuse switch in atrocious ways in C and C++ (case goes pretty much anywhere, it doesn't even look like valid syntax but it is), which is like a goto where you don't even know for sure where it will go. You can abuse pretty much every aspect of a general purpose programming language.

                                B Offline
                                B Offline
                                Bassam Abdul Baki
                                wrote on last edited by
                                #15

                                You're abusing him and his thread. ;P

                                Web - BM - RSS - Math - LinkedIn

                                1 Reply Last reply
                                0
                                • S sisnaz

                                  After coming down off of the "That's pretty cool" factor and as members on my team have increasingly been using anonymous methods, lambda expressions and new Func<> routines embedded in methods. The complexity (IMO) as increased significantly. I've begun to question this seemingly popular approach as; What's the difference between using embedded functions and a goto statement? It seems to me it's no different and just as difficult to follow and maintain. I'd be curious on other opinions of this practice.

                                  B Offline
                                  B Offline
                                  Bassam Abdul Baki
                                  wrote on last edited by
                                  #16

                                  I fell in love with Goto when I first learned it. What can I say, I was able to follow it rationally. :)

                                  Web - BM - RSS - Math - LinkedIn

                                  M 1 Reply Last reply
                                  0
                                  • OriginalGriffO OriginalGriff

                                    Yes, I agree. Every element of a language has it's use - even goto and var in C#- it's just that if you use them inappropriately you get less readable code instead of more. Personally, I find lambdas are useful in their place, but I avoid using them most of the time. var should be banned outside Linq!

                                    Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

                                    L Offline
                                    L Offline
                                    lewax00
                                    wrote on last edited by
                                    #17

                                    var is great for foreach loops when you have long types like KeyValuePairs with a generic type for the value. I don't use it often outside that.

                                    OriginalGriffO 1 Reply Last reply
                                    0
                                    • S sisnaz

                                      After coming down off of the "That's pretty cool" factor and as members on my team have increasingly been using anonymous methods, lambda expressions and new Func<> routines embedded in methods. The complexity (IMO) as increased significantly. I've begun to question this seemingly popular approach as; What's the difference between using embedded functions and a goto statement? It seems to me it's no different and just as difficult to follow and maintain. I'd be curious on other opinions of this practice.

                                      L Offline
                                      L Offline
                                      lewax00
                                      wrote on last edited by
                                      #18

                                      I don't know if the complexity increases significantly, but people well versed in imperative languages, like the majority of C#, may not be familiar with functional programming constructs, making it a little tougher to figure out just from lack of exposure. And they are harder to debug, can't seem to put breakpoints inside of them. But I probably abuse them a little, some sections of my code look more like LISP than a C-family language...especially when I realized I could use them to make wrappers out of certain loops and similar constructs that were being used over and over again in my code...

                                      1 Reply Last reply
                                      0
                                      • S sisnaz

                                        After coming down off of the "That's pretty cool" factor and as members on my team have increasingly been using anonymous methods, lambda expressions and new Func<> routines embedded in methods. The complexity (IMO) as increased significantly. I've begun to question this seemingly popular approach as; What's the difference between using embedded functions and a goto statement? It seems to me it's no different and just as difficult to follow and maintain. I'd be curious on other opinions of this practice.

                                        J Offline
                                        J Offline
                                        jschell
                                        wrote on last edited by
                                        #19

                                        sisnaz wrote:

                                        What's the difference between using embedded functions and a goto statement?

                                        Because one is cool and the other isn't. It is of course related to the difference between understanding the syntax of a language and being able to write syntax that is maintainable.

                                        S 1 Reply Last reply
                                        0
                                        • L Lost User

                                          Yes, you can abuse lambda's and make a mess. You can abuse goto and make a mess. You can abuse boolean variables to simulate some forms of goto and make just as big a mess. You can abuse operator overloading and make a mess, and when James Gosling says you can't have operator overloading in Java, you can make just as big a mess with method overloading and virtual methods if you set your mind to it. You can abuse switch in atrocious ways in C and C++ (case goes pretty much anywhere, it doesn't even look like valid syntax but it is), which is like a goto where you don't even know for sure where it will go. You can abuse pretty much every aspect of a general purpose programming language.

                                          E Offline
                                          E Offline
                                          ekolis
                                          wrote on last edited by
                                          #20

                                          harold aptroot wrote:

                                          You can abuse switch in atrocious ways in C and C++ (case goes pretty much anywhere, it doesn't even look like valid syntax but it is)

                                          Are you saying that you can have a case statement without an enclosing switch? :wtf: What does THAT look like, and what would one use it for?

                                          L 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