9 thoughts
last posted Aug. 30, 2014, 8:41 p.m.

5 earlier thoughts


There are lots of things that seem obviously wrong only once you discover the problem. Up until that point, you can read the code over and over as you work on it, and never see the issue.

It seems like Javascript Promises are particularly prone to this sort of sharp edge.

Today's example:

this.worker.doSomething() .then(...) .catch(...)

This works fine, so long as this.worker actually has a method that returns a Promise called doSomething.

In our case, this used to have a worker, which became worker(), which meant doSomething() stopped working.

I like the way Promises make my code look at a glance, but they fundamentally provide illusions: they make async code look synchronous (linear), and they use words like catch that we're used to seeing with different semantics.

It'll be interesting to see how I feel about them in another 90 days.

3 later thoughts