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. Another Horror

Another Horror

Scheduled Pinned Locked Moved The Weird and The Wonderful
28 Posts 15 Posters 1 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 Narotham Babu Kalluri

    I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); } And this part is written in many places of the application

    A Offline
    A Offline
    adamsappel
    wrote on last edited by
    #2

    now THAT'S a true horror.

    P 1 Reply Last reply
    0
    • N Narotham Babu Kalluri

      I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); } And this part is written in many places of the application

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

      Does you company pay for lines of code? :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      N 1 Reply Last reply
      0
      • C CPallini

        Does you company pay for lines of code? :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        N Offline
        N Offline
        Narotham Babu Kalluri
        wrote on last edited by
        #4

        I would definetly make that suggestion in the next apprisal cycle

        P 1 Reply Last reply
        0
        • N Narotham Babu Kalluri

          I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); } And this part is written in many places of the application

          S Offline
          S Offline
          Single Step Debugger
          wrote on last edited by
          #5

          My humble advice to you is: CHANGE THE COMPANY!!!

          The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.

          1 Reply Last reply
          0
          • N Narotham Babu Kalluri

            I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); } And this part is written in many places of the application

            P Offline
            P Offline
            Paul Conrad
            wrote on last edited by
            #6

            Narotham Babu Kalluri wrote:

            this part is written in many places of the application

            That's too bad. What was the programmer thinking?

            "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

            P 1 Reply Last reply
            0
            • A adamsappel

              now THAT'S a true horror.

              P Offline
              P Offline
              Paul Conrad
              wrote on last edited by
              #7

              Yes, it is. Hopefully the coder is no longer with that company.

              "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

              C 1 Reply Last reply
              0
              • N Narotham Babu Kalluri

                I would definetly make that suggestion in the next apprisal cycle

                P Offline
                P Offline
                Paul Conrad
                wrote on last edited by
                #8

                You need to suggest doing stricter code reviews, if your company doesn't already do so.

                "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                1 Reply Last reply
                0
                • P Paul Conrad

                  Narotham Babu Kalluri wrote:

                  this part is written in many places of the application

                  That's too bad. What was the programmer thinking?

                  "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                  P Offline
                  P Offline
                  Perspx
                  wrote on last edited by
                  #9

                  I think he'd switched off ;) Regards, --Perspx

                  "I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
                  "Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds

                  P 1 Reply Last reply
                  0
                  • P Perspx

                    I think he'd switched off ;) Regards, --Perspx

                    "I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
                    "Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds

                    P Offline
                    P Offline
                    Paul Conrad
                    wrote on last edited by
                    #10

                    Perspx wrote:

                    switched

                    :laugh: Nice play on word there :-D

                    "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                    P 1 Reply Last reply
                    0
                    • P Paul Conrad

                      Perspx wrote:

                      switched

                      :laugh: Nice play on word there :-D

                      "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

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

                      Thanks :) Regards, --Perspx

                      "I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
                      "Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds

                      1 Reply Last reply
                      0
                      • N Narotham Babu Kalluri

                        I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); } And this part is written in many places of the application

                        L Offline
                        L Offline
                        Lutoslaw
                        wrote on last edited by
                        #12

                        It seems that someone simply has knowledge leaks. Knowing that it is possible to pass a value of a variable to a function directly not like this, is bloody essential thing and it would be nice if someone told him or her that. Just snoop around to find out who wrote this and make a good deed today. Hmm.. it's a funny horror anyway. :)

                        Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

                        1 Reply Last reply
                        0
                        • N Narotham Babu Kalluri

                          I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); } And this part is written in many places of the application

                          C Offline
                          C Offline
                          cpkilekofp
                          wrote on last edited by
                          #13

                          Narotham Babu Kalluri wrote:

                          I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); }

                          Since this programmer obviously can't make a switch in code, your company should make a switch of employees.

                          P L 2 Replies Last reply
                          0
                          • C cpkilekofp

                            Narotham Babu Kalluri wrote:

                            I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); }

                            Since this programmer obviously can't make a switch in code, your company should make a switch of employees.

                            P Offline
                            P Offline
                            Paul Conrad
                            wrote on last edited by
                            #14

                            Someone voted you down for that. Gave you a 5 to balance it out :rolleyes:

                            "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                            C 1 Reply Last reply
                            0
                            • P Paul Conrad

                              Someone voted you down for that. Gave you a 5 to balance it out :rolleyes:

                              "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

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

                              Paul Conrad wrote:

                              Someone voted you down for that. Gave you a 5 to balance it out

                              :laugh: Thanks

                              1 Reply Last reply
                              0
                              • N Narotham Babu Kalluri

                                I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); } And this part is written in many places of the application

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

                                Ah. Don't worry about it. You see, the compiler takes a look at this and works out the redundancy. In fact, the redundancy notices should be on their desks by the time the link cycle has completed.

                                Deja View - the feeling that you've seen this post before.

                                My blog | My articles | MoXAML PowerToys

                                1 Reply Last reply
                                0
                                • P Paul Conrad

                                  Yes, it is. Hopefully the coder is no longer with that company.

                                  "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                                  C Offline
                                  C Offline
                                  CARPETBURNER
                                  wrote on last edited by
                                  #17

                                  I hope your using the term "Coder" loosely there... Probably better said by saying **** Monkey, with approporiate word inserted in place of Code..

                                  1 Reply Last reply
                                  0
                                  • C cpkilekofp

                                    Narotham Babu Kalluri wrote:

                                    I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); }

                                    Since this programmer obviously can't make a switch in code, your company should make a switch of employees.

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

                                    if (a >= 1 && a <= 4)
                                    DoSomething(a);

                                    is a better option than a switch I think :) .

                                    Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

                                    C 1 Reply Last reply
                                    0
                                    • L Lutoslaw

                                      if (a >= 1 && a <= 4)
                                      DoSomething(a);

                                      is a better option than a switch I think :) .

                                      Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

                                      C Offline
                                      C Offline
                                      cpkilekofp
                                      wrote on last edited by
                                      #19

                                      gajatko wrote:

                                      if (a >= 1 && a <= 4) DoSomething(a); is a better option than a switch I think .

                                      Hmmmm...in this case, yes :)

                                      V 1 Reply Last reply
                                      0
                                      • N Narotham Babu Kalluri

                                        I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); } And this part is written in many places of the application

                                        D Offline
                                        D Offline
                                        dojohansen
                                        wrote on last edited by
                                        #20

                                        LOL

                                        1 Reply Last reply
                                        0
                                        • N Narotham Babu Kalluri

                                          I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); } And this part is written in many places of the application

                                          D Offline
                                          D Offline
                                          dojohansen
                                          wrote on last edited by
                                          #21

                                          That is almost beautiful in it's inelegance! It is hard to come up with something convoluted and still have code that looks like the person writing it didn't try hard to make it as convoluted as possible...

                                          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