eclipse-thingweb / node-wot

Components for building WoT devices or for interacting with them over various IoT protocols
https://thingweb.io
Other
161 stars 78 forks source link

Use `promisify` or `new Promise` pattern. #580

Open relu91 opened 2 years ago

relu91 commented 2 years ago

In some tests, we use promisify where the other places we use the new Promise pattern. Personally, I found promisify less verbose and more explicit, but we have to choose a consistent pattern for the codebase.

_Originally posted by @relu91 in https://github.com/eclipse/thingweb.node-wot/pull/579#discussion_r728727283_

egekorkan commented 2 years ago

Could it be an artifact from the days of JS where promises were polyfilled?

relu91 commented 2 years ago

Could it be an artifact from the days of JS where promises were polyfilled?

Actually, promisify is a nodeJS module to transform callback programming style in Promises. I don't think is an artifact...

egekorkan commented 2 years ago

By an artifact, I meant that the module was used since the baked in Promise was not available and simply stayed there even though that the new promise pattern became available. I think we should simply use the baked-in way since new Node.js developers probably do not even hear about the promisify way :)

relu91 commented 2 years ago

It seems that promisify does something more. Read this best practices

JKRhb commented 11 months ago

I think in most places, we use the new Promise pattern by now – should we still try to perform an alignment? Or is the current state fine as it is?

danielpeintner commented 11 months ago

Personally I am fine with the status quo. Does anyone insist of doing (more) alignments?