Best Function Ever
-
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" ?
-
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" ?
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
-
I'd say since it's JavaScript, use
===
instead of==
. ;P /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
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" ?
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.
-
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" ?
"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
-
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
Looks like code intended for debugging.
-
"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
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
-
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" ?
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.
-
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" ?
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!
-
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.
MarkTJohnson wrote:
one too many
It's much worse than that; it has fully twice as many as required! :omg:
-
MarkTJohnson wrote:
one too many
It's much worse than that; it has fully twice as many as required! :omg:
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.
-
"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
-
Looks like code intended for debugging.
agreed:thumbsup:
I do not fear of failure. I fear of giving up out of frustration.
-
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" ?
This look like obfuscators's poop... Obfuscator creates this kind of code all over the place ...
-
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.
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?