Nodejs v7.6.0 release would support async/await

Node.js v7.6.0 is just released

Node.js v7.6.0 release change log: node/CHANGELOG_V7.md at master · nodejs/node · GitHub

One of the shining change is that this release contains V8 engine 5.5.
V8 engine is the javascript engine which node.js is underlining using. With V8 engine 5.5, it would support async/await features. ( V8 JavaScript Engine: V8 Release 5.5 )

Async programming – Promise/async & await

In Javascript/node.js, there are multiple ways to dual with async programming.
With ES2016, people can use Promise syntax.
And with ES2017, people can use async/await syntax.

Promise style async programming:

Equivalent async/await style async programming:

Why async/await is better than Promise?

There are multiple advantages:

  • The async/awwait style is much cleaner with less coding block/scopes. Promise would wrap the codes in difference function scopes.
  • We can use try catch to catch errors for sync/async codes.
  • Less lines. The general coding style of most people usually need several lines to write a wrapping function.

 


 

Remarks:

Node.js actually support async/await since v7, but it is locked in harmony flag until v7.6.0.

給想學Programming的新手建議

過去都試過有好幾次有唔係IT既朋友問我學programming有冇咩advise俾到佢地。

其實, 都真係好睇佢地各自purpose係想做乜。
寫mobile app寫網頁寫backend application其實係唔同範疇黎, advise都唔同。
亦有朋友purpose係想寫特定行業既野, 例finance既application, 我唔熟都俾唔到咩advise。

不過, generally, 我通常都會advise, 如果係新手入門, 最好先學下掌握下少少基本concept。
而打好concept底, 我通常都建議係由python入手。

python唔係新野, 有一定歷史, 有一定community。但python亦都易上手。
唔好以為係舊野, 其實好多data analytic library都係python base, data analytic其實係黎緊既trend, 學完都有potential用得返(唔似pascal學完出黎冇人用)。

當然, java我估可能係最多job(好耐冇搵工, 印象中係咁), 由java入手都ok, 但學python會易上手d。

冇特別preference唔建議由frontend stack(javascript)入手, 因為太多野要同時學, 難上手。

mobile app, 我都會建議睇清楚諗清楚。
黎緊係咪仲興mobile app, 定係轉緊其他trend, 要諗諗依d問題。(open question, 各自可以諗諗)

推介Javascript development IDE – VSCode

[opensource IDE][javascript]
試用過一個microsoft出既opensource IDE, 叫visual studio code (同visual studio係完全兩樣獨立既野黎)。

vscode係比較新, 2015先出。
定位大概係類似atom果種。

我試用過, 裝下基本extension, 其實已經好強大。
內置command terminal, git, debugger整合。
用黎做node.js development一流, 用落慣左會發覺好用過notepad++好多。

相比atom, 食少d resources, 順暢好多。
用落好少要load time, 好responsive。

堅覺得vscode幾有potential。