You are viewing a single comment's thread from:

RE: NodeJS - Callbacks, Promises, or Async/Await?

in #nodejs6 years ago (edited)

Howdy Kap!

Consider adding the following tags to your post. I know some folks who watch these categories that will love this.

technology
programming
science

I am new to async and I think I prefer it too. The main problem I have with Promises, is that they try to use classic a Object Oriented Programming approach. When I was in college learning OO, they taught us in a very similar way. Like this...

Let's say our object is a car. The car has a start() method. It also has an IsStarted property. In order to start the cart, we fire the start() method and set the IsStarted property to true.

This way, all students could see how these relationships worked, and it helped make sense of Object Oriented Programming.

I see Promises trying to do the exact same thing. All of these tutorials on how to use them usually sound like this...

Let's say your mother makes you a promise. If you get good grades in school, she will buy you a new car. First you have to go and get good grades, which takes a while. etc.

The problem I have is exactly what you mention here.

So here is my premise and thesis point...

By forcing the OO concept into async calls with Promises, we end up trading in callback hell for christmas tree hell.

Asynchronous programming is not really an OO concept. It is more about using non-blocking, function pointers later on.

Coin Marketplace

STEEM 0.17
TRX 0.13
JST 0.029
BTC 56263.97
ETH 2964.97
USDT 1.00
SBD 2.18