And this is why Javascript can be such an awful language. Leaving off a single equals has such a profound effect, often without a new coder even realizing it while reading the code. Imagine what happens to your code when someone tries to write a function for its side effects similar to the example seen in the blog post. Then releases it in production for it to break in six months with a feature change.
>"And this is why Javascript can be such an awful language." To be fair, this is breaking Javascript and that is something you could do in other languages, for instance here is a similar version for C++: http://pastebin.com/seySfpku
Nerdsniping: A glimpse into a stubborn mind
81–90 of 94 posts
Re: Nerdsniping: A glimpse into a stubborn mind
#82Re: Nerdsniping: A glimpse into a stubborn mind
#83Earlier quoted context omitted.
Wasting other people's time is a negative, but deepening your understanding of a topic by examining edge cases is generally worthwhile, IMHO.
I think he's referring to some people's inability to balance technical issues and product commitments (deadlines). Focusing solely on the means and disregarding the ends is a good way to not deliver anything useful. Most times, things need to be good enough, not technically perfect...
This sentence means almost literally nothing, given how varied both "good enough" and "technically perfect" definitions are for each developer.
Re: Nerdsniping: A glimpse into a stubborn mind
#84 In [3]:
class TheObjectThatIsEqualToAnything(object):
def __eq__(self, other):
return True
In [4]:
x = TheObjectThatIsEqualToAnything()
In [6]:
x == 3 and x == 5
Out [6]:
TrueRe: Nerdsniping: A glimpse into a stubborn mind
#85Re: Nerdsniping: A glimpse into a stubborn mind
#861 - 3 + 2.25 = 4 - 6 + 2.25
1^2 + 2(1)(1.5) + (1.5)^2 = (2)^2 - 2(2)(1.5) + (1.5)^2
Since a^2 - 2ab + b^2 = (a - b)^2
(1-1.5)^2 = (2-1.5)^2
1 = 2
QED.
Re: Nerdsniping: A glimpse into a stubborn mind
#87The differences between programming syntax and elementary/Boolean algebra are very awkward to understand clearly and deal with correctly. We clearly understand mathematical algebra to work one way, and we naturally assume programming algebra works the same way, which it doesn't at all. Here, the antagonist says that b can't be 1 and 2 at the same time, which would be self-evident in mathematical algebra, but turns ou…
These things are more of quirks of javascript than anything else. The post did nothing but made me hate javascript. Try doing the same in Java !
Re: Nerdsniping: A glimpse into a stubborn mind
#88Earlier quoted context omitted.
Wasting other people's time is a negative, but deepening your understanding of a topic by examining edge cases is generally worthwhile, IMHO.
Is it really fair to call poor code an edge case? If not for the double-equals typo, which most code reviews would fix, this wouldn't work. I'm more interested that this team has conversations where person A asks a really simple question that should be able to be tested in 11 seconds, person B gives a patently false answer that mistakes && for ||, which is the very thing person A is asking about. Meanwhile person C g…
Re: Nerdsniping: A glimpse into a stubborn mind
#89Earlier quoted context omitted.
In Obj-C you can if you would allow `a.prop == b.prop`.
Sure, but then it's obvious that you're doing something beyond an equality comparison.
Re: Nerdsniping: A glimpse into a stubborn mind
#90Earlier quoted context omitted.
> And this is why Javascript can be such an awful language. Leaving off a single equals has such a profound effect, often without a new coder even realizing it while reading the code. You get used to this as you get seasoned with javascript. Every language has it's quirks. The human brain is remarkably adaptable to using tools & dealing with intricacies. I personally utilize & appreciate the difference between == and…
>> I also find automated testing, logging, a module system like commonjs, and linters to be useful when programming in javascript Except when I use JSLint. Talk about bringing you back to Earth when you think you've done something remarkable with JS.