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. Best Function Ever

Best Function Ever

Scheduled Pinned Locked Moved The Weird and The Wonderful
javascriptcollaborationtoolsquestion
17 Posts 14 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
    LNogueira
    wrote on last edited by
    #1

    I was looking to a web site that a team mate developed and found this briliant function :)

    <script type="text/javascript">
    function callPostBack() {

          if (1 == 2)
              return true;
          else
              return false;
      }
    

    </script>

    What would you say to that "developer" ?

    S RaviBeeR P Z M 8 Replies Last reply
    0
    • L LNogueira

      I was looking to a web site that a team mate developed and found this briliant function :)

      <script type="text/javascript">
      function callPostBack() {

            if (1 == 2)
                return true;
            else
                return false;
        }
      

      </script>

      What would you say to that "developer" ?

      S Offline
      S Offline
      Sentenryu
      wrote on last edited by
      #2

      well, considering the language, i can't bash him...

      I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p) "Given the chance I'd rather work smart than work hard." - PHS241 "'Sophisticated platform' typically means 'I have no idea how it works.'"

      1 Reply Last reply
      0
      • L LNogueira

        I was looking to a web site that a team mate developed and found this briliant function :)

        <script type="text/javascript">
        function callPostBack() {

              if (1 == 2)
                  return true;
              else
                  return false;
          }
        

        </script>

        What would you say to that "developer" ?

        RaviBeeR Offline
        RaviBeeR Offline
        RaviBee
        wrote on last edited by
        #3

        I'd say since it's JavaScript, use === instead of ==. ;P /ravi

        My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

        Z 1 Reply Last reply
        0
        • L LNogueira

          I was looking to a web site that a team mate developed and found this briliant function :)

          <script type="text/javascript">
          function callPostBack() {

                if (1 == 2)
                    return true;
                else
                    return false;
            }
          

          </script>

          What would you say to that "developer" ?

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

          I would possibly mention it to him in passing. I have learned to no longer ridicule code no matter how idiodic that it appears, because I may just be belittling the code to the person that wrote it. Plus, I have come across my own mistakes that appear almost as brilliant as the example you have posted. I can only imagine started an idea, and never returned to that piece of code.

          To know and not do, is not yet to know

          A 1 Reply Last reply
          0
          • RaviBeeR RaviBee

            I'd say since it's JavaScript, use === instead of ==. ;P /ravi

            My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

            Z Offline
            Z Offline
            ZurdoDev
            wrote on last edited by
            #5

            Good call. :)

            There are only 10 types of people in the world, those who understand binary and those who don't.

            1 Reply Last reply
            0
            • L LNogueira

              I was looking to a web site that a team mate developed and found this briliant function :)

              <script type="text/javascript">
              function callPostBack() {

                    if (1 == 2)
                        return true;
                    else
                        return false;
                }
              

              </script>

              What would you say to that "developer" ?

              Z Offline
              Z Offline
              ZurdoDev
              wrote on last edited by
              #6

              I would ask why first? Perhaps there used to be a condition they were checking for and then at some point found out they didn't need it. It's easier to modify this one function then stop calling it from everywhere it could be used. I would have expected a comment in it though, if that were the case.

              There are only 10 types of people in the world, those who understand binary and those who don't.

              1 Reply Last reply
              0
              • L LNogueira

                I was looking to a web site that a team mate developed and found this briliant function :)

                <script type="text/javascript">
                function callPostBack() {

                      if (1 == 2)
                          return true;
                      else
                          return false;
                  }
                

                </script>

                What would you say to that "developer" ?

                M Offline
                M Offline
                Mladen Jankovic
                wrote on last edited by
                #7

                "What kind of debugging technique it is?" That's my first thought. During debugging I would routinely put code like this to make debugging easier:

                if(i == 4)
                i = 4;

                or

                if(n == nullptr)
                i = i;

                more from me | GALex: C++ Library for Advanced Genetic Algorithms

                P L 2 Replies Last reply
                0
                • P Paul M Watt

                  I would possibly mention it to him in passing. I have learned to no longer ridicule code no matter how idiodic that it appears, because I may just be belittling the code to the person that wrote it. Plus, I have come across my own mistakes that appear almost as brilliant as the example you have posted. I can only imagine started an idea, and never returned to that piece of code.

                  To know and not do, is not yet to know

                  A Offline
                  A Offline
                  Andy Bantly
                  wrote on last edited by
                  #8

                  Looks like code intended for debugging.

                  M 1 Reply Last reply
                  0
                  • M Mladen Jankovic

                    "What kind of debugging technique it is?" That's my first thought. During debugging I would routinely put code like this to make debugging easier:

                    if(i == 4)
                    i = 4;

                    or

                    if(n == nullptr)
                    i = i;

                    more from me | GALex: C++ Library for Advanced Genetic Algorithms

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

                    Exactly. Good and Bad code are created one line at a time. This happens to be a chunk of forgotten code.

                    To know and not do, is not yet to know

                    1 Reply Last reply
                    0
                    • L LNogueira

                      I was looking to a web site that a team mate developed and found this briliant function :)

                      <script type="text/javascript">
                      function callPostBack() {

                            if (1 == 2)
                                return true;
                            else
                                return false;
                        }
                      

                      </script>

                      What would you say to that "developer" ?

                      M Offline
                      M Offline
                      MarkTJohnson
                      wrote on last edited by
                      #10

                      Well, to take a point from a previous thread, it has one too many return statements. Ducks and runs for cover. :laugh: At least I stay consistent.

                      Mark "So old school, Socrates was in his first year teaching." Johnson Don't like the shot clock, the three point shot, or the designated hitter either.

                      P 1 Reply Last reply
                      0
                      • L LNogueira

                        I was looking to a web site that a team mate developed and found this briliant function :)

                        <script type="text/javascript">
                        function callPostBack() {

                              if (1 == 2)
                                  return true;
                              else
                                  return false;
                          }
                        

                        </script>

                        What would you say to that "developer" ?

                        S Offline
                        S Offline
                        Super Lloyd
                        wrote on last edited by
                        #11

                        What the heck were you drinking that day mate?!

                        My programming get away... The Blog... DirectX for WinRT/C# since 2013! Taking over the world since 1371!

                        1 Reply Last reply
                        0
                        • M MarkTJohnson

                          Well, to take a point from a previous thread, it has one too many return statements. Ducks and runs for cover. :laugh: At least I stay consistent.

                          Mark "So old school, Socrates was in his first year teaching." Johnson Don't like the shot clock, the three point shot, or the designated hitter either.

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

                          MarkTJohnson wrote:

                          one too many

                          It's much worse than that; it has fully twice as many as required! :omg:

                          M 1 Reply Last reply
                          0
                          • P PIEBALDconsult

                            MarkTJohnson wrote:

                            one too many

                            It's much worse than that; it has fully twice as many as required! :omg:

                            M Offline
                            M Offline
                            MacSpudster
                            wrote on last edited by
                            #13

                            Yes, it does have twice as many as needed. He gets paid by the code line. Then, when time comes to refactor and he gets paid by reducing the number of code lines, it's a double-paycheck score.

                            E 1 Reply Last reply
                            0
                            • M Mladen Jankovic

                              "What kind of debugging technique it is?" That's my first thought. During debugging I would routinely put code like this to make debugging easier:

                              if(i == 4)
                              i = 4;

                              or

                              if(n == nullptr)
                              i = i;

                              more from me | GALex: C++ Library for Advanced Genetic Algorithms

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

                              Mladen Janković wrote:

                              if(i == 4) i = 4;

                              Was "4" chosen by a fair dice roll[^]?

                              Greetings - Jacek

                              1 Reply Last reply
                              0
                              • A Andy Bantly

                                Looks like code intended for debugging.

                                M Offline
                                M Offline
                                Mohibur Rashid
                                wrote on last edited by
                                #15

                                agreed:thumbsup:

                                I do not fear of failure. I fear of giving up out of frustration.

                                1 Reply Last reply
                                0
                                • L LNogueira

                                  I was looking to a web site that a team mate developed and found this briliant function :)

                                  <script type="text/javascript">
                                  function callPostBack() {

                                        if (1 == 2)
                                            return true;
                                        else
                                            return false;
                                    }
                                  

                                  </script>

                                  What would you say to that "developer" ?

                                  E Offline
                                  E Offline
                                  ExcellentOrg
                                  wrote on last edited by
                                  #16

                                  This look like obfuscators's poop... Obfuscator creates this kind of code all over the place ...

                                  1 Reply Last reply
                                  0
                                  • M MacSpudster

                                    Yes, it does have twice as many as needed. He gets paid by the code line. Then, when time comes to refactor and he gets paid by reducing the number of code lines, it's a double-paycheck score.

                                    E Offline
                                    E Offline
                                    ExcellentOrg
                                    wrote on last edited by
                                    #17

                                    Bingo!!! Where is such company that pays that way... Can I have address and name of HR and name of the bar she frequents after work?

                                    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