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. Coding Horror (No limits for over logic)

Coding Horror (No limits for over logic)

Scheduled Pinned Locked Moved The Lounge
regextutorial
12 Posts 10 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    My boss asked me to rewrite a class and while understanding that class behavior I saw this amazing over logic, anti-pattern example:

    if (a != b || c == d){
    if (c == d){
    // ...
    if(a != b){
    // ...
    }
    }else{
    // ...
    }
    }

    Enjoy...

    OriginalGriffO H M K R 9 Replies Last reply
    0
    • L Lost User

      My boss asked me to rewrite a class and while understanding that class behavior I saw this amazing over logic, anti-pattern example:

      if (a != b || c == d){
      if (c == d){
      // ...
      if(a != b){
      // ...
      }
      }else{
      // ...
      }
      }

      Enjoy...

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

      Someone thought a lot before coding that... We do have a place for such code: Weird And Wonderful[^]

      Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

      "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

      1 Reply Last reply
      0
      • L Lost User

        My boss asked me to rewrite a class and while understanding that class behavior I saw this amazing over logic, anti-pattern example:

        if (a != b || c == d){
        if (c == d){
        // ...
        if(a != b){
        // ...
        }
        }else{
        // ...
        }
        }

        Enjoy...

        H Offline
        H Offline
        HobbyProggy
        wrote on last edited by
        #3

        Fantastic work LMAO :-\

        if(this.signature != "") { MessageBox.Show("This is my signature: " + Environment.NewLine + signature); } else { MessageBox.Show("404-Signature not found"); }

        1 Reply Last reply
        0
        • L Lost User

          My boss asked me to rewrite a class and while understanding that class behavior I saw this amazing over logic, anti-pattern example:

          if (a != b || c == d){
          if (c == d){
          // ...
          if(a != b){
          // ...
          }
          }else{
          // ...
          }
          }

          Enjoy...

          M Offline
          M Offline
          musefan
          wrote on last edited by
          #4

          It would be interesting to see what you proposed improvement for such logic is?

          L 1 Reply Last reply
          0
          • L Lost User

            My boss asked me to rewrite a class and while understanding that class behavior I saw this amazing over logic, anti-pattern example:

            if (a != b || c == d){
            if (c == d){
            // ...
            if(a != b){
            // ...
            }
            }else{
            // ...
            }
            }

            Enjoy...

            K Offline
            K Offline
            Killzone DeathMan
            wrote on last edited by
            #5

            I think there is missing somthing... "}" ;P

            1 Reply Last reply
            0
            • L Lost User

              My boss asked me to rewrite a class and while understanding that class behavior I saw this amazing over logic, anti-pattern example:

              if (a != b || c == d){
              if (c == d){
              // ...
              if(a != b){
              // ...
              }
              }else{
              // ...
              }
              }

              Enjoy...

              R Offline
              R Offline
              Ramug10
              wrote on last edited by
              #6

              Nice work.... :)

              1 Reply Last reply
              0
              • M musefan

                It would be interesting to see what you proposed improvement for such logic is?

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

                All that logic was unnecessary (:confused:), I just dropped that piece of code off.

                1 Reply Last reply
                0
                • L Lost User

                  My boss asked me to rewrite a class and while understanding that class behavior I saw this amazing over logic, anti-pattern example:

                  if (a != b || c == d){
                  if (c == d){
                  // ...
                  if(a != b){
                  // ...
                  }
                  }else{
                  // ...
                  }
                  }

                  Enjoy...

                  A Offline
                  A Offline
                  Argonia
                  wrote on last edited by
                  #8

                  Ah, that code is not complete the coder wrote that forgot the most important part. What if a!= b and c==d ? :laugh: We need another if in that one. Don't forget it in your new class :laugh:

                  Microsoft ... the only place where VARIANT_TRUE != true

                  1 Reply Last reply
                  0
                  • L Lost User

                    My boss asked me to rewrite a class and while understanding that class behavior I saw this amazing over logic, anti-pattern example:

                    if (a != b || c == d){
                    if (c == d){
                    // ...
                    if(a != b){
                    // ...
                    }
                    }else{
                    // ...
                    }
                    }

                    Enjoy...

                    P Offline
                    P Offline
                    Paul M Watt
                    wrote on last edited by
                    #9

                    Careful. We'll be laughing at your code next week ;)

                    L 1 Reply Last reply
                    0
                    • P Paul M Watt

                      Careful. We'll be laughing at your code next week ;)

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

                      If that happens I'll learn something!

                      1 Reply Last reply
                      0
                      • L Lost User

                        My boss asked me to rewrite a class and while understanding that class behavior I saw this amazing over logic, anti-pattern example:

                        if (a != b || c == d){
                        if (c == d){
                        // ...
                        if(a != b){
                        // ...
                        }
                        }else{
                        // ...
                        }
                        }

                        Enjoy...

                        J Offline
                        J Offline
                        jeron1
                        wrote on last edited by
                        #11

                        Neglecting the logic, just the curly brace placement makes me cringe.

                        1 Reply Last reply
                        0
                        • L Lost User

                          My boss asked me to rewrite a class and while understanding that class behavior I saw this amazing over logic, anti-pattern example:

                          if (a != b || c == d){
                          if (c == d){
                          // ...
                          if(a != b){
                          // ...
                          }
                          }else{
                          // ...
                          }
                          }

                          Enjoy...

                          B Offline
                          B Offline
                          BillW33
                          wrote on last edited by
                          #12

                          Looks like another justification for my signature line. X|

                          Just because the code works, it doesn't mean that it is good code.

                          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