TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

My Reality Moment. Why did I ever agree to do this?

46 pointsby rubikscubeover 9 years ago

8 comments

chucksmashover 9 years ago
Interesting article though it feels a bit incomplete. The writer very briefly introduces this concept of a &quot;reality moment&quot; , gives an example and that&#x27;s that. The example is interesting and the concept rings true; I&#x27;d like to see more time spent discussing the concept in and of itself.<p>The only time I remember seeing this addressed outside of a &quot;programmers are bad at estimating tasks so do x to get better estimates&quot; context was a post by Jeff Atwood about the tendency of programmers to look at something like StackOverflow and see, basically, two CREATE TABLE statements[1]. The reality moment, then, sounds like the moment one sees past that &quot;weekend worth of coding&quot;. A bit more fleshing out, maybe with an examination of why we think this way would be a great read.<p>[1]: <a href="http:&#x2F;&#x2F;blog.codinghorror.com&#x2F;code-its-trivial&#x2F;" rel="nofollow">http:&#x2F;&#x2F;blog.codinghorror.com&#x2F;code-its-trivial&#x2F;</a>
评论 #10242824 未加载
carsongrossover 9 years ago
<i>We need creativity mixed with discipline to make a difference here.</i><p>Or we could pick a non-insane language to standardize on.<p>Even better, we could pick a non-insane <i>bytecode</i> to standardize on.
评论 #10242331 未加载
dumaelover 9 years ago
As a compiler developer I honestly shudder reading this. From the last example:<p>&gt; $ node<p>&gt; &quot;5&quot; + &quot;1&quot;<p>&gt; &#x27;51&#x27;<p>&gt; &quot;5&quot; - &quot;1&quot;<p>&gt; 4<p>How is this in anyway reasonable behavior? &#x27;+&#x27; is string concatenation but &#x27;-&#x27; is interpret these strings as numbers and perform arithmetic?<p>Does the principle of least surprise apply here?
评论 #10242572 未加载
评论 #10242883 未加载
评论 #10242476 未加载
评论 #10243245 未加载
评论 #10242746 未加载
Mithalduover 9 years ago
And those kinds of issues are why Perl has ==&#x2F;!=&#x2F;+ for numbers and eq&#x2F;ne&#x2F;. for strings.
评论 #10242255 未加载
makeitsucklessover 9 years ago
&gt; But the usage of &quot;===&quot; is fairly uncommon in most PHP programs.<p>I don&#x27;t code PHP anymore, but the use of &quot;===&quot; has been standard practice for ages, and checking for it fully automated.<p>It&#x27;s one of the many areas in which uninformed people like to criticize PHP for bad practices that in reality have been left behind a long time ago and are only still supported by the language for backward compatibility reasons.
joshribakoffover 9 years ago
I only have experience in dynamic languages. I don&#x27;t get the point of the article? Is the article implying type coercion is bad because its inefficient in terms of CPU cycles? In a decade of programming in dynamic languages, I&#x27;ve never had string comparison be a bottleneck. It is usually IO that is the bottleneck, and the trade off is that by using dynamic languages like JS it becomes easy to make your IO non blocking. If you really have some logic that needs to compare millions of strings, you could always write that algorithm in a static compiled language, and shell out to it from your dynamic language.
评论 #10242530 未加载
评论 #10243021 未加载
danansover 9 years ago
12 years ago, I was working on a PHP library to parse XMLRPC requests, and I ran into it&#x27;s numeric type slipperiness in a painful way. I was (naively) using PHP&#x27;s eval to parse a decimal numeric string.<p>I noticed what seemed like random numeric errors in a random subset of RPCs. It turned out, after what seemed like eons of investigation, that some clients were stringifying decimal integers with leading zeros, which made PHP interpret them as octal numbers, and hence the random seeming errors.<p>Having come from a strongly-typed-language background (C&#x2F;C++&#x2F;Java), that was a major learning experience about the caveats of weakly typed languages.
评论 #10242842 未加载
asahover 9 years ago
Yes, dynamic languages are... dynamic...<p><a href="http:&#x2F;&#x2F;www.eecs.berkeley.edu&#x2F;Pubs&#x2F;TechRpts&#x2F;1994&#x2F;CSD-94-812.pdf" rel="nofollow">http:&#x2F;&#x2F;www.eecs.berkeley.edu&#x2F;Pubs&#x2F;TechRpts&#x2F;1994&#x2F;CSD-94-812.p...</a>
评论 #10244035 未加载