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. Other Discussions
  3. The Weird and The Wonderful
  4. Clever Coder or Annoying SmartAss?

Clever Coder or Annoying SmartAss?

Scheduled Pinned Locked Moved The Weird and The Wonderful
debuggingquestiondiscussion
16 Posts 9 Posters 0 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.
  • C Offline
    C Offline
    Caslen
    wrote on last edited by
    #1

    Trying to debug some old code written 3-4years ago by a previous employee and came across this - I can't decide if he's a hero or an idiot, what do you think? (and before anyone says it, yes I know its legal - and it works (mostly) but try debugging it when it doesn't!)

    for (; (Var1 < Var2) && (Var3 == FALSE) && ( ( Var4 < 0 ) || (Var5 <= Var6) ); Var7++)
    {
    .
    .
    //700 lines of code
    .
    .
    }

    D G R S B 7 Replies Last reply
    0
    • C Caslen

      Trying to debug some old code written 3-4years ago by a previous employee and came across this - I can't decide if he's a hero or an idiot, what do you think? (and before anyone says it, yes I know its legal - and it works (mostly) but try debugging it when it doesn't!)

      for (; (Var1 < Var2) && (Var3 == FALSE) && ( ( Var4 < 0 ) || (Var5 <= Var6) ); Var7++)
      {
      .
      .
      //700 lines of code
      .
      .
      }

      D Offline
      D Offline
      Dalek Dave
      wrote on last edited by
      #2

      He deserves a medal for being able to construct it!

      ------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] Trolls[^]

      1 Reply Last reply
      0
      • C Caslen

        Trying to debug some old code written 3-4years ago by a previous employee and came across this - I can't decide if he's a hero or an idiot, what do you think? (and before anyone says it, yes I know its legal - and it works (mostly) but try debugging it when it doesn't!)

        for (; (Var1 < Var2) && (Var3 == FALSE) && ( ( Var4 < 0 ) || (Var5 <= Var6) ); Var7++)
        {
        .
        .
        //700 lines of code
        .
        .
        }

        G Offline
        G Offline
        GibbleCH
        wrote on last edited by
        #3

        Well "700 lines of code in a block" = Idiot.

        A 1 Reply Last reply
        0
        • G GibbleCH

          Well "700 lines of code in a block" = Idiot.

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

          True. Everybody knows the limit is 558 lines. :rolleyes:

          Martin Fowler wrote:

          Any fool can write code that a computer can understand. Good programmers write code that humans can understand.

          S 1 Reply Last reply
          0
          • C Caslen

            Trying to debug some old code written 3-4years ago by a previous employee and came across this - I can't decide if he's a hero or an idiot, what do you think? (and before anyone says it, yes I know its legal - and it works (mostly) but try debugging it when it doesn't!)

            for (; (Var1 < Var2) && (Var3 == FALSE) && ( ( Var4 < 0 ) || (Var5 <= Var6) ); Var7++)
            {
            .
            .
            //700 lines of code
            .
            .
            }

            R Offline
            R Offline
            RobCroll
            wrote on last edited by
            #5

            Maybe someone told them the while statement was going to be deprecated. And they believed it! I also like the title case for variable names.

            "You get that on the big jobs."

            C 1 Reply Last reply
            0
            • A AspDotNetDev

              True. Everybody knows the limit is 558 lines. :rolleyes:

              Martin Fowler wrote:

              Any fool can write code that a computer can understand. Good programmers write code that humans can understand.

              S Offline
              S Offline
              StM0n
              wrote on last edited by
              #6

              it's an coding constant... like the speed of light :laugh:

              (yes|no|maybe)*

              1 Reply Last reply
              0
              • C Caslen

                Trying to debug some old code written 3-4years ago by a previous employee and came across this - I can't decide if he's a hero or an idiot, what do you think? (and before anyone says it, yes I know its legal - and it works (mostly) but try debugging it when it doesn't!)

                for (; (Var1 < Var2) && (Var3 == FALSE) && ( ( Var4 < 0 ) || (Var5 <= Var6) ); Var7++)
                {
                .
                .
                //700 lines of code
                .
                .
                }

                S Offline
                S Offline
                StM0n
                wrote on last edited by
                #7

                Never seen something like that... but it's kind of... attractive... in a way... strange way... forbidden way... :-O

                (yes|no|maybe)*

                C 1 Reply Last reply
                0
                • R RobCroll

                  Maybe someone told them the while statement was going to be deprecated. And they believed it! I also like the title case for variable names.

                  "You get that on the big jobs."

                  C Offline
                  C Offline
                  Caslen
                  wrote on last edited by
                  #8

                  To be fair I changed the variables names myself (to protect the guilty). Capitalising variable names is something I've always done, 20 years or more, it's a hard habit to break - old dog and new tricks if you know what I mean :)

                  1 Reply Last reply
                  0
                  • S StM0n

                    Never seen something like that... but it's kind of... attractive... in a way... strange way... forbidden way... :-O

                    (yes|no|maybe)*

                    C Offline
                    C Offline
                    Caslen
                    wrote on last edited by
                    #9

                    You must resist - its a sure path to the dark side...

                    S 1 Reply Last reply
                    0
                    • C Caslen

                      You must resist - its a sure path to the dark side...

                      S Offline
                      S Offline
                      StM0n
                      wrote on last edited by
                      #10

                      ... I can't... have to write... strange code... oops, no it's been

                      while

                      ;P

                      (yes|no|maybe)*

                      C 1 Reply Last reply
                      0
                      • S StM0n

                        ... I can't... have to write... strange code... oops, no it's been

                        while

                        ;P

                        (yes|no|maybe)*

                        C Offline
                        C Offline
                        Caslen
                        wrote on last edited by
                        #11

                        for(;1==1;i++){if(!i)goto End;}
                        End:

                        Still tempted? :)

                        S 1 Reply Last reply
                        0
                        • C Caslen

                          for(;1==1;i++){if(!i)goto End;}
                          End:

                          Still tempted? :)

                          S Offline
                          S Offline
                          StM0n
                          wrote on last edited by
                          #12

                          done it, until it feels false :-D

                          (yes|no|maybe)*

                          1 Reply Last reply
                          0
                          • C Caslen

                            Trying to debug some old code written 3-4years ago by a previous employee and came across this - I can't decide if he's a hero or an idiot, what do you think? (and before anyone says it, yes I know its legal - and it works (mostly) but try debugging it when it doesn't!)

                            for (; (Var1 < Var2) && (Var3 == FALSE) && ( ( Var4 < 0 ) || (Var5 <= Var6) ); Var7++)
                            {
                            .
                            .
                            //700 lines of code
                            .
                            .
                            }

                            B Offline
                            B Offline
                            BobJanova
                            wrote on last edited by
                            #13

                            Hard to tell given the level of anonymisation you've done. If it's a hard problem then such a complex test might be appropriate. I'd probably write it as a while loop, since the 'incrementer' is a different variable. I do agree though that the 'Real WTF' is the 700 lines inside a loop construct.

                            1 Reply Last reply
                            0
                            • C Caslen

                              Trying to debug some old code written 3-4years ago by a previous employee and came across this - I can't decide if he's a hero or an idiot, what do you think? (and before anyone says it, yes I know its legal - and it works (mostly) but try debugging it when it doesn't!)

                              for (; (Var1 < Var2) && (Var3 == FALSE) && ( ( Var4 < 0 ) || (Var5 <= Var6) ); Var7++)
                              {
                              .
                              .
                              //700 lines of code
                              .
                              .
                              }

                              R Offline
                              R Offline
                              richard_k
                              wrote on last edited by
                              #14

                              Ok.. so far I can buy smart.. although I'm not fond of HOW the code is formatted.. I try to format more complex if statements so that its obvious what is going on.. ergo:

                              for ( ;
                              (Var1 < Var2)
                              && (Var3 == FALSE)
                              && ( ( Var4 < 0 )
                              || (Var5 <= Var6) );
                              Var7++)
                              {
                              .
                              .
                              //700 lines of code
                              .
                              .
                              }

                              I used to do PLC programming and loved how ladder logic read.. so this is a hold over from those days for me.. I'm ALL about readability.. On 700 lines.. idiot for sure. Now.. my question to determine if this guys is a TRUE idiot.. does he re-use any of those test variables for other purposes in his massive 700 line pile of spaghetti? If so.. then he gets promoted to 'Principle Idiot'. The reason I ask this is.. I've seen that.. a 3000 line function that re-used control and locally declared variables for complete different purposes.. trying to debug that mess was like messing with a wierd 3-dimensional puzzle. The guy that wrote it, god bless his soul, at least wasn't a CS guy.. he was a business analyst. Give a child a pistol....

                              C 1 Reply Last reply
                              0
                              • R richard_k

                                Ok.. so far I can buy smart.. although I'm not fond of HOW the code is formatted.. I try to format more complex if statements so that its obvious what is going on.. ergo:

                                for ( ;
                                (Var1 < Var2)
                                && (Var3 == FALSE)
                                && ( ( Var4 < 0 )
                                || (Var5 <= Var6) );
                                Var7++)
                                {
                                .
                                .
                                //700 lines of code
                                .
                                .
                                }

                                I used to do PLC programming and loved how ladder logic read.. so this is a hold over from those days for me.. I'm ALL about readability.. On 700 lines.. idiot for sure. Now.. my question to determine if this guys is a TRUE idiot.. does he re-use any of those test variables for other purposes in his massive 700 line pile of spaghetti? If so.. then he gets promoted to 'Principle Idiot'. The reason I ask this is.. I've seen that.. a 3000 line function that re-used control and locally declared variables for complete different purposes.. trying to debug that mess was like messing with a wierd 3-dimensional puzzle. The guy that wrote it, god bless his soul, at least wasn't a CS guy.. he was a business analyst. Give a child a pistol....

                                C Offline
                                C Offline
                                Caslen
                                wrote on last edited by
                                #15

                                Var1 - 17 references Var2 - 5 references Var3 - 14 references... ...and so on - believe me its spaghetti!

                                1 Reply Last reply
                                0
                                • C Caslen

                                  Trying to debug some old code written 3-4years ago by a previous employee and came across this - I can't decide if he's a hero or an idiot, what do you think? (and before anyone says it, yes I know its legal - and it works (mostly) but try debugging it when it doesn't!)

                                  for (; (Var1 < Var2) && (Var3 == FALSE) && ( ( Var4 < 0 ) || (Var5 <= Var6) ); Var7++)
                                  {
                                  .
                                  .
                                  //700 lines of code
                                  .
                                  .
                                  }

                                  T Offline
                                  T Offline
                                  thoiness
                                  wrote on last edited by
                                  #16

                                  That's downright amazing. I don't think I would have ever thought of that. It really makes you wonder, who does think like that? Was the author an expert in regex per chance?

                                  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