2014-08-12 node.js - 非同期処理やQの話 node.js Wordpressから静的HTMLへの移行 Pyramid of Doom 非同期処理をうまく処理するためにQを使っている。QはPromiseとそれを使用するアルゴリズムで構成されている。 どうも人間というのは上から下にフローが流れていかないと理解が難しくなるようである。コールバックによる非同期処理を行うと縦方向と同時に右横方向にフローが流れていく。これを﹁Pyramid of Doom(破滅︵死︶のピラミッド?)﹂と呼ぶそうだ。 step1(function (value1) { step2(value1, function(value2) { step3(value2, function(value3) { step4(value3, function(value4) { // Do something wi
![node.js - 非同期処理やQの話 - S.F. Page](https://cdn-ak-scissors.b.st-hatena.com/image/square/458dcb1cd06be23db1ae50d1d1daf5801d0d0018/height=288;version=1;width=512/http%3A%2F%2Fcdn.image.st-hatena.com%2Fimage%2Fscale%2Fbc98e0076503f4e639b88ef009c2020300e7e9ef%2Fbackend%3Dimager%3Benlarge%3D0%3Bheight%3D1000%3Bversion%3D1%3Bwidth%3D1200%2Fhttp%253A%252F%252Fcdn.mogile.archive.st-hatena.com%252Fv1%252Fimage%252Fsfpgmr%252F297791837018231785.png)