2 ms·
Promises don't have a built-in way to cancel chains (neither do plain callbacks) That is a false comparison. A function is not comparable to a promise chain.
by austin-cheney 3y ago
Promises don't have a built-in way to cancel chains (neither do plain callbacks)
That is a false comparison. A function is not comparable to a promise chain. A chain of callbacks can be cancelled by simply returning early in one callback instead of calling or responding to a forthcoming additional event.
Not all Node APIs have promise methods regardless of the few you use personally. This sounds more like people trying to impose their vanity opinions. The mentality of: It sometimes works for me, so other people are wrong if they don't do it the way that matches my preferences.
and even question why someone uses callbacks in their code if I interview them.
Why would you pose the question if you already biased against the answer? Is this an attempt to prejudice a candidate?
- moring 3y ago> Why would you pose the question if you already biased against the answer? Why would you pose _this_ question if you are already biased against the answer? :) But to answer your question: 1. to question your own bias. You might get an answer you didn't expect that actually helps you gain new insight. 2. to inform the candidate that good reasons are needed to keep their style if they want to work for you. "I prefer my own style because I'm used to it" creates single points of failure, while "I prefer this style because of X" improves code quality.
- matharmin 3y agoI see what you mean about promise chain cancellation, I misunderstood that part. You can still structure Promises using nesting instead of chains to get the same effect as with callbacks, but in reality I just use async/await instead. > Why would you pose the question if you already biased against the answer? Is this an attempt to prejudice a candidate? By question I mean I may judge the candidate for it. Of course it's your choice if you prefer callbacks, but I'd view that as a potential compatibility issue with my team.