Home

Node.js evolution

Node.js logo

Node.js in blessed, enterprise version 1.0 comes faster then you might have expected (look at the first link in references - Isaac said that 0.12 is the last version before the final release). What will the future bring us?

Bert Belder’s talk on LXJS 2013 gives us a small overview about what is to come. It obviously has a provocative first slide and title, but the point still stands - what should we expect from Node.js 2.0 ?

Tasks

One nifty concept, called Asynchronous Tasks, was presented in the talk.

It was presented as an asynchronous try...catch block without changing the language syntax and semantics. Let’s look at the initial representation:

 1 task.create(function concatTwoFilesAndThenSomeTask() {
 2 
 3   fs.readFile("some/template", "utf8", function (error, file1) {
 4 
 5     if (error) {
 6       throw error;
 7     }
 8 
 9     fs.readFile("something/else", "utf8", function (error, file2) {
10 
11       if (error) {
12         throw error;
13       }
14 
15       var data = file1 + "--" + file2;
16 
17       data = data.replace(/foo/g, "bar");
18       return data;
19     });
20 
21   });
22 
23 }).setCallback(function (error, result) {
24 
25   if (error) {
26     throw error;
27   }
28 
29   // Do something with the result.
30 });

Of course it is a simple concept, which ignores many thing e.g. EventEmitter. But it also gives us many things e.g. meaningful stack traces with asynchronous operations or handling errors of composite asynchronous operations in one place.

I know that there exist modules which can do that (like async), but having it built into the platform seems very interesting and brings other capabilities (e.g. under-the-hood optimization) which the additional modules do not have.

The whole concept has evolved into something called by Bert a domains2 module. You can find details in references.

What else?

We have to remember that the world will not stay in place and will evolve. And Node.js in the blessed, enterprise version has to evolve too. The owners are the pushing platform in the right direction and I totally agree that Node.js should have a thin core as it has right now. However, there are definitely many things which can land in it.

How about:

The reported enhancements are just the tip of the iceberg and even you can expand this list. I encourage you to subscribe to Node.js mailing list and then observe, learn, share ideas and experience, discuss.

I encourage you to be a conscious and active member of the community, maybe involve in some initiatives mentioned above, like mirroring or scaling the NPM etc.

The future looks promising only with the platform evolving with it - and evolution depends only on us.

References

  1. Isaac Shlueter - The Road to Node.js v1.0
  2. Bert Belder - Node.js 2.0 (LXJS 2013)
  3. domains2
  4. Node.js Logo
Home