3 ms·
> Douglas Crockford Is Not Your Dad No, he's your drunk uncle who sounds smart when you're young. When you learn to form opinions of your own, you realize that
by gwbas1c 2y ago
> Douglas Crockford Is Not Your Dad
No, he's your drunk uncle who sounds smart when you're young. When you learn to form opinions of your own, you realize that his opinions are worthless hot air.
Many years ago I went to a session where he promoted asynchronous Javascript as the "one true way." In the Q&A, I pointed out that callbacks made code much harder to read and maintain compared to threaded code; and then asked if there was a cleaner way to do it.
His answer was quite rude. A few years later, we got the "async" keyword, which solved the problem.
- cma 2y agoAs soon as you lose stack traces things become so much harder to debug
- Vekz 2y agoDeeply nested inline anonymous function callbacks are the anti pattern. Decoupled explicit named functions passed as callbacks are a significantly better developer experience and provide clearer stack traces. I never understood why this conversation didn't take the lexicon and instead the imo inferior `async` pattern got pushed hard.
- hombre_fatal 2y agoExtracting callbacks into separate functions is just more indirection. And they don't solve the core issue of async control flow that async/await solves, so it's not an alternative to async/await much less a superior one. A classic example is when you want to conditionally do something asynchronously like B() in this case. function process(id, callback) { A(id, (result) => { if (result === 3) { B(() => { C(result, callback); }); } else { C(result, callback); } }); } Versus: async function process(id) { const result = await A(id); if (result === 3) { await B(); } return C(result); } Add a couple more layers of this and the async/await function stays simple and flat, and the callback version grows significantly more complex and nested.
- mu53 2y agoWithout the async keyword, it was far superior to anons. Also, named functions showed up on stack traces making it easy to know what is getting called No serious person is going to claim that any form of callbacks is superior to async/wait
- gibbitz 2y agoDon't forget having to use try... catch for exception handling. This is why promises are the one true way!
- justin66 2y ago> he's your drunk uncle The way you've bitterly dwelled [0][1] on something Crockford once said about async during a Q&A for 15 years or something is maybe a little bit weird. [0] https://news.ycombinator.com/item?id=41142972 https://news.ycombinator.com/item?id=41142972 [1] https://news.ycombinator.com/item?id=22365466 https://news.ycombinator.com/item?id=22365466
- gwbas1c 2y agoI think it's weirder to dig though my comment history and link to it.
- justin66 2y agoI remembered your recent, similar comment in a Crockford says something mildly controversial thread and looked to see how many times you'd commented on the same incident. (of course I expect I missed a few of them) There, I've explained myself, and I think the explanation is relatively straightforward. Now you. Why do you obsess bitterly over something Crockford said to you fifteen years ago during a Q&A? Perhaps more importantly, have you discussed Crockford with a therapist?
- nemothekid 2y ago>I went to a session where he promoted asynchronous Javascript as the "one true way." Note that your question didn't challenge this point (Async javascript is the "one true way", given that blocking in browser context always degrades the user experience).
- ZiiS 2y agoIf we had not accepted async we would almost certainly got threading support in Browsers.
- Feathercrown 2y agoThreads in browsers sounds like an absolute nightmare of new browser bugs and dev issues
- gwbas1c 2y agoHe was promoting Node for server-side programming. Every other framework was either multiprocess or multithreaded.