Node.js 的发明者将Javascript程序拓展到浏览器之外
译者 matthewgao
Node.js inventor extends JavaScript programming beyond browsers Interview: Ryan Dahl discusses why his invention is catching fire with developers
Node.js 的发明者将Javascript程序拓展到浏览器之外 采访: Ryan Dahl 解释为什么他的发明能够让开发者着迷
By Paul Krill | InfoWorld Follow @pjkrill
By Paul Krill | InfoWorld Follow @pjkrill
Print|Add a comment
The open source project Node.js was invented by Joyent software engineer Ryan Dahl three years ago next month. It essentially allows JavaScript to be used outside of a browser. Node leverages Google's V8 JavaScript virtual machine to interpret JavaScript, and it uses an event-driven non-blocking I/O model that cloud services vendor Joyent -- a principal Node advocate -- says makes it ideal for data-intensive and real-time applications running across distributed devices. It is also championed by companies such as Microsoft and Mozilla.
三年前的下个月,Joyent的软件工程师 Ryan Dahl 开发了Node.js 这个开源项目。他使得Javascript能够运行于浏览器之外。Node使用Google的V8 Javascript虚拟机来解释Javascript,使用Joyent云服务提供商提供的由事件驱动的无阻塞I/O模型,这是Node提倡的一个原则--它能够有效的用分布式设备来处理数据密集的实时应用。这同时也被微软和Mozilla这样的公司所支持
InfoWorld Editor at Large Paul Krill spoke with Dahl at the Joyent-sponsored Node Summit conference, which is being held in San Francisco.
InfoWorld 的编辑Paul Krill 和 Dahl 在在旧金山举行的由Joyent赞助的Node高峰会议上进行了对话
[ Node.js is an InfoWorld 2012 Technology of the Year Award Winner. For more insight on software development, subscribe to InfoWorld's Developer World newsletter. ]
[Node.js 是Infoworld 2012 年度技术奖的获得者。想得到更进一步的关于软件开发的内容,请订阅InfoWorld世界开发者时事通讯]
InfoWorld: Node is basically server-side JavaScript framework, right?
InfoWorld:Node 实际上是一个服务器端的Javascript框架是么?
Dahl: Yes. It's a programming platform. Node is a way of doing programming with JavaScript, but on your computer instead of inside the Web browser so you can interact with the operating system and whatnot.
Dahl:是的,是一个编程平台。Node是一个用Javascript进行编程,但是运行在电脑上而不是运行在web浏览器上的一个方案,所以你能够与操作系统等进行交互。
InfoWorld: What's the main benefit?
InfoWorld:他的主要好处是什么?
Dahl: Node does things a bit differently than other programming platforms. The main thing is that it handles I/O very differently, so it doesn't allow the user to lock up the program, ever. It keeps the user handling new things, so it's very useful for network programming. You often are dealing with many people at the same time on your server and you're juggling these different connections. Node encourages the developer to continue to process connections without blocking. And because of this model of handling I/O, users tend to find it easier than developing with a traditional programming language for servers.
Dahl:Node和其他编程平台在运行上有些不同。主要的是在I/O控制上非常不同,所以不允许用户挂起程序。它使得使用者控制新东西,所以他对于网络编程非常有用。你通常会在服务器上同时处理很多人的请求,并且处理不同的连接。Node鼓励开发者持续的处理连接而不阻断它。因此这种处理I/O的模型让使用者能够更容易的用传统的程序语言做服务器端的开发。
InfoWorld: Why is Node catching fire, so to speak?
InfoWorld:这就是说为什么Node火了?
Dahl: It just turns out that a lot of people like to program in JavaScript, and so there's been a lot of interest from users to develop stuff.
Dahl:产生的结果是很多人喜欢用Javascript编程序,所以在使用者开发的时候有很多乐趣。
InfoWorld: Is there an issue with running Node on Windows?
InfoWorld:有什么办法可以让Node在Windows上运行么?
Dahl: Well, the port to Windows is a lot newer than the Unix implementation and does have a couple of bugs. But generally users are using it fine. It tends to be working well. Of course, it'll get better over time.
Dahl:当然,给Windows平台的接口是要比Unix上的新,所以一定会有一些Bug。但是基本可以很好的运行。
InfoWorld: Are there any particular advantages of Node as far as platform-as-a-service cloud computing and cloud computing in general?
InfoWorld:对于Paas云计算和普通的云计算Node有没有什么特别的优势?
Dahl: Well, it's JavaScript, which is a nice thing. And it has this nice little API that is somewhat compact. So I think it makes for a nice platform-as-a-service platform in general. It also does network communication.
Dahl:当然,它是Javascript,一个非常好的东西。它有如此精巧的紧凑的API。所以它对于Paas的云计算平台非常有效,同时对于网络通信也非常有效。
InfoWorld: How many people are developing with Node? What's the growth rate for Node?
InfoWorld:有多少人在用Node做开发?Node的成长率是多少?
Dahl: It's a bit difficult to quantify, though the way that we usually measure this is by the number of modules that have been deployed with Node or developed with Node. We're currently at about 6,000 modules. These are various modules to connect to Twitter or to parse some random disk format, [for example].
Dahl:这个很难衡量,我们实际上是通过有多少个使用Node或者用Node开发的模块来统计的。我们现在又大概6000个模块。这些不同的模块连接到Twitter或者解析一些随机的磁盘格式,[例如]。
InfoWorld: What would be the ideal situation for Node and where would you not want to use it?
InfoWorld:Node在什么情况下用是最理想的,什么情况下不能用?
Dahl: Ideally, it's for servers where you're juggling many connections, with a lot of I/O happening in the server. It's not so good for batch jobs where you're doing a bunch of serial tasks and it doesn't really matter how long they take, you're just running them at the end of the day. There it becomes unwieldy due to the non-blocking nature of it.
Dahl:理想上,用于那些要处理非常多的有大量I/O的连接的服务器。对于那些只在每天的结束才会运行,并不在意运行多久的批处理工作并不合适。它会由于无阻塞的特性而使得他变得笨拙。
This article, "Node.js inventor extends JavaScript programming beyond browsers," was originally published at InfoWorld.com. Follow the latest developments in business technology news and get a digest of the key stories each day in the InfoWorld Daily newsletter. For the latest developments in business technology news, follow InfoWorld.com on Twitter.
“Node.js 的发明者将Javascript程序拓展到浏览器之外”这篇文章原文发布在InfoWorld.com,属于最新商务技术开发新闻,每天在InfoWorld时事通讯中得到文章摘要,更多最新商务技术开发新闻在Twitter上关注InfoWorld.com
Paul Krill is an editor at large at InfoWorld, focusing on coverage of application development (desktop and mobile) and core Web technologies such as HTML5, Java, and Flash.
Paul Krill 是InfoWorld的一个编辑,关注与应用开发(桌面和移动应用)和WEB技术,例如HTML5,JAVA和Flash
Tags: javascript, paas