HNHacker News
TopNewBestAskShowJobs

eldude

665 karma · joined December 15, 2011

Your lack of megalomania is disconcerting.
submissionscomments
eldude··on Why I am switching to promises
I addressed your point and you are acknowledging it and I can see you understand it from you various other responses. Promises catch "synchronous" exceptions, however unlikely. You can optionally rethrow them / manually crash, which you would need to. Your response is also the most common response, "don't worry about them and deal with them when they come up."

I prefer to avoid this mentality and it motivates the difference in our opinions.

eldude··on Why I am switching to promises
FWICT, I fully understand the example and addressed your points directly. You can wrap callbacks to catch everything or always crash, aka

     while allowing non-caught async errors to be handled in a custom manner as you point out.
And the referenced github issue furthers my point,

   Promises coerce caught exceptions occurring on the origin tick to errors (bad)
first via the OP[1]

    Is it possible to turn try { ... } catch off in the bluebird promise implementation?
and then via Dominic Denicola's characteristic snark[2]

    class PromiseThatMissesThePointOfPromises {
    ...
Please point out anything I am misunderstanding.

[1] https://github.com/petkaantonov/bluebird/issues/51

[2] https://github.com/petkaantonov/bluebird/issues/51#issuecomm...

eldude··on Why I am switching to promises
You're talking about the core/userland boundary beyond the origin tick, and we're both right. Promises coerce caught exceptions occurring on the origin tick to errors (bad), while allowing non-caught async errors to be handled in a custom manner as you point out.

The comments following your linked comment address this nuance. I agree with Raynos that the core of the issue is as I point out here, 2 divergent incompatible error handling mechanisms, with both of them fundamentally broken:

* error passing fails because we don't have CPS due to lack of Proper Tail Calls

* throwing fails because we lack async try/catch or at least with async generators we lack a performant try/catch or with bluebird-like optimizations (hacks) we lack typed catch and Error.create

The latter is far closer to a consistent error handling pattern than the former, which promises implement (poorly and verbosely IMO). Additionally, async generators also nicely address the issue of slicing your userland stack away from core, so you get a two for one.

eldude··on Why I am switching to promises
The problem with discussions of promises vs ... is there's usually a great deal of misunderstanding about what problem promises are solving: enforcement of the callback contract. I could go on for hours about the subtleties in the conversation, but the gist of it boils down to this:

    Node callbacks have a strict but entirely unenforced (in userland) contract:
The contract:

    * Callbacks should be called OAOO

    * Never throw (explicitly or implicitly) after origin tick (aka pass post-tick errors to callback)
There is also an increasingly common informal contract:

    * Never throw ever (aka pass ALL errors to the callback)
But there are a couple of issues that get in the way of successful enforcement of this contract:

    * When external libraries violate this contract (library A calls library B,
      but library B violates the contract in a way that makes it difficult for
      library A to easily maintain the contract)

    * Asynchronous errors

    * Crash-worthy exceptions
Inevitably, this all continually comes back to error handling over and over again, with the core issue being that node.js has 2 divergent methods for error handling: exceptions (try/catch/throw) and error passing (callback(err)). Exceptions requires opt-in error handling (crash by default) while error passing requires opt-out error handling (crash on demand) "and never the twain shall meet."

Promises attempt to resolve this by coercing all exceptions to error passing, but not all exceptions are safe to be passed. Specifically, any exception originating from core that is not an invalid argument exception (think 4XX vs 5XX class errors) cannot safely be caught / coerced / continued on. Also, not all errors passed to callbacks are even theoretically passable as the unofficial policy of core is that core callback errors are only distinguishable from exceptions in that they occur after the origin tick. In other words, they are equally crash-worthy and equally non-crash-worthy.

So promises are an improvement because when used pervasively, they enforce the formal and informal callback contracts, while providing a continuable-like representation of the value that can be passed around.

This benefit of contract enforcement is entirely independent of the specific API implementations.

The stepup[1] library trivially accomplishes contract enforcement by integrating the async trycatch[2] module without using promises or requiring pervasive usage. I've used them both for years now in various professional projects, with trycatch in use here at LinkedIn. Additionally, stepup could easily return a continuable to support a passable value representation.

Async generators will solve most of this though, allowing node.js to ditch the error passing for exception handling, but since Error subclassing and typed catches are basically not supported in node.js the language keeps getting in the way of a satisfactory complete solution. This is a whole other discussion.

In conclusion, error handling in node.js is an undesigned mess of which the core contributors don't even seem to fully understand or be aware[3,4]. FWIW, node.js' crash on error design is a DoS liability, which spion addresses in the article, and which LinkedIn uses trycatch to avoid.

[1] https://npmjs.org/package/stepup

[2] https://npmjs.org/package/trycatch

[3] https://github.com/joyent/node/issues/5114

[4] https://github.com/joyent/node/issues/5149

eldude··on Are Your Programmers Working Hard, Or Are They Lazy?
There is currently a great deal of potential for disruption of engineering business organization hierarchy. At the heart of the problem is how to cohesively address the limited distribution of control, freedom, money, stability and reward.

A good example of one aspect of this is LinkedIn's technical career track. Beyond sole contributor status, you can be promoted to either a Manager or a Staff Engineer. Managers have direct reports, while Staff Engineers lead teams with a technical responsibility, each with their own progression: Manager < Sr Manager < Director < Sr Director < VP < Sr VP and Staff Engineer < Sr Staff < Principal < Distinguished < Fellow. The Engineering track is more of an accreditation system focusing on freedom as opposed to control (control of things vs people).

Most Silicon Valley companies struggle with retention, because they internally cannot simultaneously offer a "fair" career progression/compensation and compete with the raw efficient risk/reward of the free market (e.g., poaching). In other words, you can't promote engineers with potential over engineers with good track records without consequently discouraging hard work. On the other hand, you absolutely don't want engineers with potential to leave because of an inability to offer opportunity equal to what they can find elsewhere.

Companies will ultimately need to offer choice to engineers: higher vs lower risk/reward. One possibility is a commission based engineering track. Engineers would choose between the stability of traditional progression/salary and a higher reward commission based system with a small base salary. The commission system would require results-based quantitative systems like OKRs (Objectives and Key Results) to quantify both the value of the proposal to the company beforehand, and a quantitative measurement of its success. Switching between tracks could occur each quarter allowing engineers to tap temporary motivation increases. Mixing and matching traditional and commissioned engineers would result in unique balances of high motivation and stability (since the team lead is not their manager), which would highly align with stable vs high risk/growing aspects/departments of the company.

The increasing competition faced from engineers starting their own companies will require companies to adapt new compensation models to more efficiently allocate resources (e.g., autonomy, cash, responsibility, recognition, etc...). I think a commission based system holds a lot of promise for those of greater capability.

eldude··on Node v0.10.23 (Stable)
See AGen Spec[1] & gens[2], which implements it.

[1] https://github.com/AsynchronousGenerators/agen-spec

[2] https://github.com/Raynos/gens

eldude··on First water plume seen firing from Jupiter moon Europa
Checkout the movie Europa Report to feed your SciFi fantasies.
eldude··on Why Are We Building Jailbait Sexbots?
Here's a philosophical question, as technology progresses to the point that virtual reality is so good that it is able to replace real children in cases like these and satisfy child predators thus eliminating victims is this a fundamentally morally good thing?
eldude··on Facebook Messenger 3.0
You're missing the distinction; Nobody kept their MySpace around or created a new one once is was replaced because it was unnecessary. You could say it's like AOL Instant Messenger, but if anything that's a weaker analogy since nothing really replaced it so much as IM became a commodity.
eldude··on What happened when my co-founder quit the night before our YC interview
I bet you'll never forget the memory and ironic imagery of walking in with celebratory champagne for a startup that lost one of its founders to a room full of founders.

Also, would love an opportunity for a seat at one of those poker games.

eldude··on Facebook Messenger 3.0
Facebook isn't just losing ground to a specific demographic, they're losing centrality and relevance in a market they defined. While Facebook may be pervasive, it's pervasive in the way that Microsoft Office was in an era of Macs and Google Apps 2 years ago; We all kept a copy of Word installed for when someone emailed us a .doc or .ppt file.

Would love to grab lunch or discuss further where this is all headed from a broader market and societal standpoint, for anyone in the Bay Area.

eldude··on The Coach Who Never Punts
Very cool to see a fellow Arkansan and Little Rocker on HN![1] Ping me if you're ever in the valley, would love to grab lunch.

[1] https://news.ycombinator.com/item?id=6730823

eldude··on The Coach Who Never Punts
This is just about the most absolutely bizarre thing in the world for me to see my High School football coach on the front page of Hacker News. I attended Pulaski Academy (PA) 6th-10th grade and played football there from 7th-10th grade, 1 under Coach Kelley who was then the Defensive Coach while I was a cornerback (and tailback).

As coaches go, Coach Kelley was smart, far smarter than any coach I had at Plano West, one of the premier school districts for football in Texas. He pushed us hard, had a great sense of humor, and was out to win. PA was also the best school I have ever attended (I also grew up in Rancho Santa Margarita in Orange County, CA).

I guess what I'm trying to say is that while this is completely bizarre to find it on a Silicon Valley tech site like Hacker News, I honestly can't say I'm all that shocked. Sometimes when you meet people, you just understand and know that there's something different about them, a potential for greatness, that they are a mold breaker. Their current circumstances may be unexceptional, but you have confidence they will go on to do great things. I think this is of course what we (HN) share culturally with a football coach from Little Rock, AR: a desire to think outside the box, to break the mold, and achieve what little greatness we believe we are capable of achieving.

I owe a great deal of my professional success to Coach Kelley and Pulaski Academy, so seeing them realize this level of success by being different, smarter, fills me with pride and warms my heart.

eldude··on Let’s get serious about ES6 generator functions
Good stuff. This will come in handy if node.js 0.12 takes much longer.

Watching the use of generators in JavaScript and especially node.js is going to be very exciting over the coming years. We're excited at LinkedIn because we write a lot of node.js, and control flow is always being discussed: step, async, stepup, promises, and async generators look to solve a lot of that.

Also, checkout the AGen formal spec[1] for asynchronous generators. Raynos and I put it together recently to encourage interoperability between async generator solutions, and we're both using it in personal projects.[2]

[1] https://github.com/AsynchronousGenerators/agen-spec

[2] https://github.com/Raynos/gens

eldude··on The American Dream, RIP?
These are non sequiturs.

Corruption or ineffective government are not exclusive to Texas. You're just spouting more ignorance and from your lower comment are clearly bigoted against Texans.

My original point stands that the use of exurbs as a pejorative in the OP is easily refuted by the experience of anyone who lives there. I used to live in Frisco, TX, an exurb of Dallas and the mere suggestion that it offered anything inferior is absurd and quite frankly just completely oblivious.

eldude··on The American Dream, RIP?
So the worst case here is that the poor might move to GASP Texas! And enjoy a better quality of life associated with a smaller government. What a bizarrely narrow-mindedly ignorant perspective, which I imagine will resonant quite well with the anti-Walmart crowd that is equally too narrow-minded to appreciate the impact and empowerment Walmart has on the poor.
eldude··on Taken
I would argue history disagrees with you that "state and local governments [...] most abused peoples' rights." See the American Revolution / British Empire, Nazi Germany, Communist Russia, etc... etc...

Also, sorry, my pro-state musings in my edit were not meant to characterize my anti-government criticism regarding the abuse of government power as pro-state. In retrospect, it was misguided for me to include that there.

eldude··on Taken
In a way, this is mostly in line with what I'm talking about in that the question we're posing together is whether the government must necessarily be smaller, or is merely buckling under the weight of an outmoded model and infrastructure that a technological solution can resolve via greater transparency and accountability.

Perhaps a more ambitious goal would be a marriage of both. Fewer laws through greater empowerment, visibility and accountability enabled only through technology. In order to get there though, I think we have many issues we will need to solve before making matters worse, like who holds root access to the the government servers?

Quis custodiet ipsos custodes?

eldude··on Taken
The sad thing is that people on both sides of the political spectrum complain only about the other side, failing to realize that their own side is equally responsible. I see a lot of people declaring, "This is not the country it used to be," but it's in regards to both PRISM, civil forfeiture, and the Patriot Act; and Obamacare, FHA Loans, and Welfare.

The true problem though is government, both altogether and the increase in the Federal government at the expense of local or State governments. Both the Democratic and Republican parties stand only to lose power by embracing either libertarian or state values. Consequently, a party that weakens itself with its own values, will always fail against a party that strengthens itself. Additionally, when the backlash from Bush's increase in government became too severe on the right, Obama stepped in to increase the size and reach of the government on the left. Until Democrats and Republicans acknowledge this, the political system will continue to use us against each other to enrich themselves and rob us of our liberties.

This is the issue of our generation: the gross overreach of government institutionalized by politicians pitting opposing mass ideologies against each other while empowering themselves. Neither Democrats nor Republicans will ever surrender their party values for fear the other will abuse the opportunity to seize more power.

We need a pro-state or libertarian party. I suspect a pro-state party would generate far greater support, likely because it is part of our historical/constitutional DNA.

EDIT: Sorry for the seemingly tenuous relation to the article. The reason this relates is that all of the justification given by local law enforcement for violating our for Fourth and Fourteenth Amendment rights were Federal precedents and Executive Orders. In other words when the Federal government consistently violates federal (constitutional) laws, local governments are emboldened to do the same. Additionally, the size and power of the federal government itself emboldens it to violate its own (constitutional) accountabilities to the people.

eldude··on I understood gender discrimination once I added “Mr.” to my resume
Since this is entirely devoid of any discernible facts, it's a little disturbing that this has made it to the front page of HN. When did random assertions become unquestioned truth?

This feels a lot like a sensationalized modern day witch hunt, "Burn the misoginists! Burn the sexists!"

Also, for whatever it's worth, never have I heard "Kim" considered anything but a woman's name.

eldude··on Supreme Court: Natural Isolated DNA Not Patentable, Synthetic DNA Is [pdf]
Michael Crichton's novel "Next"[1] was a fantastic exploration of the implications of such issues being brought up here like: liability when the infringing patents are in you, in animals, in human-animal hybrids capable of human-level intelligence, and how the world deals with life when Man plays god.

Another excellent book on the ethics of bio-engineering and patentability is the true story, "The Immortal Life of Henrietta Lacks."[2]

[1] http://en.wikipedia.org/wiki/Next_(novel) [2] http://www.amazon.com/The-Immortal-Life-Henrietta-Lacks/dp/1...

eldude··on Supreme Court: Natural Isolated DNA Not Patentable, Synthetic DNA Is [pdf]
A historical correction to the misplaced tone of your 3/5ths reference, the 3/5ths compromise was by the anti-slavery republican north to prevent the southern democratic slavers from dominating the House of Representatives and the electoral college.[1]

[1] http://www.redstate.com/jeffdunetz/2010/07/18/were-our-found...

eldude··on Polymer, a Web Components library built by Google
I think it ended up on the front page today because it was the Google IO presentation today that really showed off what they are accomplishing with Polymer. I'd encourage everyone to watch the demo[1] starts at 3:51:30.

[1] https://developers.google.com/events/io/sessions/324149970

eldude··on Polymer, a Web Components library built by Google
I was at the Google IO talk and talked to Matt McNulty, my old boss from Palm, and was blown away with what they're building.

This is the future of UI in the browser.

The declarative nature, the encapsulation, the data bindings, the attribute and event-driven APIs are all orders of magnitude simpler than existing JavaScript / HTML UI element componentization. The reusability of a custom element compared to an HTML snippet with some associated JavaScript and CSS cannot be overstated.

EDIT: understated > overstated

eldude··on You don’t have to feel guilty for oversleeping
3 years ago I could no longer fall asleep before 5am and it was severely affecting my ability to concentrate, which as a software engineer is a death knell. Like most, I internalize my problems, exacerbating my frustration, worsening sleep, and creating a negative feedback loop.

Today, I sleep like a baby, and it's INCREDIBLY EASY to fix. Follow these steps, and you'll never have difficulty falling asleep again:

1. Melatonin [1]

Melatonin is how your body knows when it's time to go to sleep. It's produced naturally, but with DSPD (Delayed Sleep Phase Disorder), by definition it occurs later than it should. Taking melatonin an hour before you go to sleep is like a hard reset. I can't overstate this enough. It doesn't matter how much blue light or caffeine you've taken (for the most part) during the day, or how stressed you are, if you take 9mg of melatonin, you'll fall asleep in an hour. Period. Eventually, with some of the below, you can achieve the same affect with 1mg, and once you establish a regular schedule you'll no longer require it at all.

2. Wake Light [2]

A natural sun alarm clock. If you get enough sleep (easy once the melatonin ensures you fall asleep on time), waking up to one of these is a breeze (and a joy).

3. Avoid Blue Light

Same thing as the article states, avoid it. Computers, iPhone, etc...

4. Cold shower [3]

It drops your body temperature and moves your blood away from your prefrontal cortex to your core alleviating your mind from racing.

5. Earplugs [4,5]

My dogs feat clitter clatter across our hard wood floors. My wife wakes up before me. Our house creeks. etc.... Occasionally I also use an eye cover, but it's less impactful.

6. Socks & t-shirt [6]

They help regulate body temperature.

7. Obey Your Sleep Cycles [7]

Our bodies have natural sleep cycles (90m for the first, ~110m for the 2-3rd). When my alarm clock goes off, and I still feel sleepy, I roll over with my eyes facing my wake light and effectively snooze until I feel awake. Eventually the combination of white light and the conclusion of my sleep cycle, leave me feeling awake and alert.

8. Sleep alarm

In my experience, it's been more important for me to set an alarm at night (9:45) to start getting ready for bed, than to set one in the morning. Having a regular sleep schedule allows you to work with your body instead of against it. If you're having trouble sleeping, or you anticipate having trouble, take melatonin until your body starts to adapt to your new schedule and it's no longer necessary.

9. Relax

1 hour before your sleep alarm you should be doing something relaxing. It won't matter if when your sleep alarm goes off, you're running around busily doing things. I make sure I'm doing something relaxing like watching TV or reading a book in bed for at least an hour before my sleep alarm goes off.

10. iPhone Wakeup

One thing that helps wake me up on those difficult mornings is to crank the brightness on my iPhone and sit and read a few articles. The white light naturally tells my body it's time to start the day, and eventually I don't mind waking up.

Life is so much better now that I can count on fantastic sleep every night!

[1] http://www.webmd.com/sleep-disorders/tc/melatonin-overview

[2] http://www.amazon.com/Philips-Hf3470-Wake-up-Light-White/dp/...

[3] https://www.google.com/search?q=cold+shower+before+sleeping

[4] http://www.amazon.com/gp/product/B0068HC0X4/ref=oh_details_o...

[5] http://www.amazon.com/gp/product/B000H7MMP2/ref=oh_details_o...

[6] http://lifehacker.com/wear-socks-to-fall-asleep-easily-47655...

[7] http://en.wikipedia.org/wiki/Sleep#cite_ref-17

eldude··on George W. Bush is smarter than you
Anecdotally, having been born and raised in Orange County, CA (11yr), then Arkansas (5yr) and finally Texas for High School and College (7yr), followed by Denver (liberal) and now Silicon Valley, I can confirm this liberal bias toward both Texas and The South, and also by self-appointed intellectuals toward individuals like myself who tend to not take themselves too seriously.

I regularly find myself catching others off-guard professionally when I exert my intellect, because they tend to have me pegged as an easy-going So-Cal / Southerner. However, from my experience, liberals and self-appointed intellectuals share all the same personality and reasoning flaws as their counterparts.

People are people and differ mostly in the person they choose to project, not in their inherent abilities. Both are honest about different portions of themselves.

eldude··on Failed Startup's Final Income Statements Reveal Grave Error
In other words, he didn't get it.

You cannot say someone truly gets that something is in their best interest if they think it's best to continue to do the opposite.

eldude··on Why your games are made by childless, 31 year old white men
This article is true to a T.

An avid gamer all my life, I joined a game company to work on a gamer centric non-gaming project. Without saying much about my time there, it culminated upon completion with the entire team being laid off, with only the lowest paid hardest working "white childless males" being kept on because they fit the founder's expectations of ideal workers.

eldude··on Steve Jobs' first boss: 'Very few companies would hire Steve, even today'
None of those provide value. I think you're confusing a hack that only takes advantage of the government in a context where the government takes advantage of us and that's meant to provide value ultimately to someone else.
eldude··on Callbacks are imperative, promises are functional
Unfortunately, in practice promises end up making your code more difficult to reason about by adding cruft and unnecessary abstraction. They're also very limiting from a control-flow perspective.

This is especially noticeable when you have branching behavior / want to resolve a promise early[1]:

Branching with promises:

  function doTask(task, callback) {
    return Q.ncall(task.step1, task)
    .then(function(result1) {
      if (result1) {
        return result1;
      } else {
        return continueTasks(task);
      }
    })
    .nodeify(callback)
  }

  function continueTasks(task) {
    return Q.ncall(task.step2, task);
    .then(function(result2) {
      return Q.ncall(task.step3, task);
    })
  }
As opposed to with stepdown[2]:

  function doTask(task, callback) {
    $$([
      $$.stepCall(task.step1),
      function($, result1) {
        if (result1) return $.end(null, result1)
      },
      $$.stepCall(task.step2),
      $$.stepCall(task.step3)
    ], callback)
  }
I would really love for a post to include a non-trivial problem implemented with promises, vanilla callbacks, and async (and I'd be happy to add a stepdown equivalent), and allow people to see for themselves (how in my opinion promises make code harder to read).

[1] http://stackoverflow.com/questions/11302271/how-to-properly-...

[2] https://github.com/Schoonology/stepdown (docs need updating, view tests for documentation)

← PreviousPage 5 of 7Next →