這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。
TJ Holowaychuk, a prominent module writer, made his farewells to Node.js and is turning to Go, which he calls a “next generation,” programming language in the same company as Rust and Julia.
It’s the latest high profile departure from Node.js to Go, as noted by Zef Hemel in a post today. In particular, he cited Felix Geisendörfer, a frequent contributor who moved on to Go in 2012.
bye #nodejs, hello #golang
— Felix Geisendörfer (@felixge) December 2, 2012
Hemel also cited Koding, which provides a web-based development environment.
Holowaychuk is the creator of the Luna programming language. He is also the force behind Koa, Express, Stylus, Cluster, Mocha, Jade and node-canvas.
He writes in a post published yesterday that Node.js does some things well but it is not suited to his interests these days in distributed systems. Node.js stresses performance over usability and robustness. He finds Go “performs better, is easier to maintain, and has better test coverage since synchronous code is generally nicer and simpler to work with.”
He likes C but it is not a language for working with every day.
For Holowaychuk, most satisfying about Go is its iteration speed. He hopes the community will be willing to break things in Go but he recognizes with big companies behind it, breaking things can be a problem for people managing big systems. But it could help make it more resilient and stronger.
Why Go
Summarizing, he says Go is robust for its age and refactoring with types is pleasant and simple. The tooling for profiling and debugging works and the community has “a very strong conventions regarding documentation, formatting, benchmarking, and API design.”
Go’s primitives are more suited to distributed computing than Node.js’s generators. Node.js does not have separate stack error handling. Without it, reporting is mediocre.
I also don’t want to wait 3 years for the community to defragment, when we have solutions that work now, and work well.
There’s also Go’s error-handling, too, which Holowaychuk says is superior. Node.js makes you look at every error, which helps the developer think but it also has some flaws, which he lists as follows:
- you may get duplicate callbacks
- you may not get a callback at all (lost in limbo)
- you may get out-of-band errors
- emitters may get multiple “error” events
- missing “error” events sends everything to hell
- often unsure what requires “error” handlers
- “error” handlers are very verbose
- callbacks suck
Howaychuk is a philosophical and a natural writer. He’s critical of Node.js but in a constructive way. In particular, he puts the onus on Joyent to make Node.js more usable.
I have written about Poptip moving to Go. Many of the emerging services use Go, too. Docker, CoreOs, Dropbox and MongoDB to name some of the more prominent users.
Are the Node.js issue overblown or misguided? I am curious about this one. It may be time do a Google Hangout on the topic.
Feature image via Creative Commons on Flickr.