Hacker News new | ask | show | jobs
by kccqzy 674 days ago
I agree. People should gradually build up their intuition from lower abstractions to higher. People should be banned from using async/await unless they had first experienced callback-based code, and then promise-based code. Going straight to async code is like asking people to run before they have learned to walk.
2 comments

It is not clear to me where you stop the tunneling down the abstractions. It seems arbitrary to each person to their knowledge base.

I have a degree in Electrical Engineering, and don't understand how programmers can function not understanding physical computer architecture.

But clearly, that's not the bar which most come from.

What? In JS async/await is _literally_ syntactic sugar for returning/thening promises.
They need to have experience and intuition working with promises without syntactic sugar, before being allowed to use syntactic sugar.

It's a basic way to learn. In Python you don't directly teach people about decorators without first asking them to explicitly reassign a function to the result of calling the decorator. In Haskell you don't teach people about do notation without first making them write nomadic code with the bind operator and many lambdas.

In many cases, just a few days of forbidding students to use the syntactic sugar is enough to make them appreciate why this syntactic sugar is needed and how it is supposed to be used. JavaScript's async/await is the same.