今天开始会和大熊君{{bb}}一起着手翻译node的系列外文书籍,大熊负责翻译《Node.js IN ACTION》一书,而我暂时负责翻译这本《Hands-on Node.js》(下载),为方便理解不采用直译的方式,若有翻译不当的地方还请不吝赐教,我会及时堪正。

引言

在09年欧洲JSConf大会上,一位叫做Ryan Dahl的年轻程序员介绍了一项他所负责的项目。该项目结合了谷歌V8 Javascript引擎以及event loop机制,从而可以使用JS来创建服务端平台。该项目跟其它服务端JS平台不太一样:所有的I/O基元都是事件驱动的,没有其它捷径。借力于强大又简单的JS,原本基于异步读写的应用任务,由复杂变得简单好实现。

Dahl演讲完毕时会场掌声不断,他的项目也取得了空前的发展,日益流行并被广泛采用。

该项目被命名为Node.js,时下常被程序员们简称为“Node”。Node提供了纯事件驱动的、无阻塞的架构来创建高并发的程序,使用它能让你轻松构造快速又可扩展的网络服务。

Introduction

At the European JSConf 2009, a young programmer by the name of Ryan Dahl, introduced a project
he had been working on. This project was a platform that combined Google’s V8 JavaScript engine
and an event loop to create a server-side platform programmable in JavaScript. The project took a
different direction from other server-side JavaScript platforms: all I/O primitives were event-driven,
and there was no way around it. Leveraging the power and simplicity of JavaScript, it turned the
difficult task of writing asynchronous applications into an easy one. Since receiving a standing
ovation at the end of his talk, Dahl’s project has been met with unprecedented growth, popularity
and adoption.
The project was named Node.js, now known to developers simply as ‘Node’. Node provides purely
evented, non-blocking infrastructure for building highly concurrent software.
Node allows you to easily construct fast and scalable network services.

原文

为何Node如此突然地、呈指数倍地流行起来?

服务端JS其实已经出现多时了,是什么让Node平台如此引人注目?

环顾之前的那些服务端JS的实现,更着重处理的地方还是把其它平台(比如Ruby、PERL、Python)上常用的方法迁移到JS中,而JS本身不露锋芒。Node跳过了这种处理,并表示——“让我们使用web上那些可成功驱动事件的编程模块,来轻松创建可扩展的服务,并让这种方式无可替代、无所不能”。

可以说JS本身为Node的成功做出了很大的贡献,但这点不能解释Node之前的其它服务端项目为何没有流行起来。虽然JS的确具备了普遍性,但对此Ryan Dah指出,不像其它服务端中JS所做的尝试,统一客户端和服务端的语言并非Node的首要目标。

在我看来,Node成功的主要因素有三个:

1. Node很简单——使用了事件驱动I/O编程,是最好的I/O编程方式,比起其它现有平台的实现更易懂、更成功。

2. Node很精练——它不会试着去解决全部问题,而是依靠清晰明确的功能性API为处理internet协议奠定了基础和支持。

3.Node不妥协——不会试着去兼容之前的软件,并让人们重新审视并首肯了其定位。

Why the sudden, exponential popularity?

Server-side JavaScript has been around for some time, what makes this platform so appealing?
In previous server-side JavaScript implementations, javascript was the raison d’etre, and the
approach focussed on translating common practices from other platforms like Ruby, PERL and
Python, into JavaScript. Node took a leap from this and said: “Let’s use the successful event-driven
programming model of the web and use it to make an easy way to build scalable servers. And let’s
make it the only way people can do anything on this platform.”.
It can be argued that JavaScript itself contributed to much of Node’s success, but that would not
explain why other the server-side projects proceeding Node have not yet come close in popularity.
The ubiquity of JavaScript surely has played a role, but, as Ryan Dahl points out, unlike other Serverside
JavaScript attempts, unifying the client and server into a common language was not the primary
goal for Node.
In my perspective there are three factors contributing to Node’s success:
1. Node is Easy - Node makes event-driven I/O programming, the best way to do I/O programming,
much easier to understand and achieve than in any other existing platform.
2. Node is Lean - Node does not try to solve all problems. It lays the foundation and supports
the basic internet protocols using clean, functional APIs.
3. Node does not Compromise - Node does not try to be compatible with pre-existing software,
it takes a fresh look at what many believe is the right direction.

原文

本书涵盖内容

我们会分析为何Node不走寻常路,以及为何你应该使用Node、如何使用Node。我们会从一个概述开始,然后很快转入模块化代码。在最终你将懂得创建和测试你自己的Node模块、服务端/客户端应用,并享受Node的便捷和各种API。

What does this book cover?

We will analyze what makes Node a different proposal to other server-side solutions, why you
should use it, and how to get started. We will start with an overview but quickly dive into some
code module-by-module. By the end of this book you should be able to build and test your own
Node modules, service producers/consumers and feel comfortable using Node’s conventions and
API.

原文

本书没有涵盖的内容

本书并不打算介绍完全部的Node API,但我们会介绍那些作者认为的大部分应用所需要的、常用的部分。

本书也不会涉及任何Node框架。Node是一个很棒的创建框架的工具,其中也不乏好用的框架,比如簇管理的、跨进程通讯的、web框架、网络流量整合工具、游戏引擎等等。不过在你开始接触框架之前,你应该先熟悉Node的基础架构并了解它为这些构建模块提供了些什么。

What does this book not cover?

This book does not attempt to cover the complete Node API. Instead, we will cover what the author
thinks is required to build most applications he would build on Node.
This book does not cover any Node frameworks; Node is a great tool for building frameworks and
many are available, such as cluster management, inter-process communication, web frameworks,
network traffic collection tools, game engines and many others. Before you dive into any of those
you should be familiar with Node’s infrastructure and what it provides to these building blocks.

原文

阅读本书的先决条件

本书假设你之前并未了解任何Node知识,但各种例子的代码毕竟是用JS书写的,所以熟悉JS这门语言有助你理解。

Prerequisites

This book does not assume you have any prior knowledge of Node, but the code examples are written
in JavaScript, so familiarity with the JavaScript language will help.

原文

练习

本书在部分小节会有练习题,你可以在书的最后找到这些练习的答案,但我建议你先自行动手解题,棘手处可查阅本书或访问http://nodejs.org查阅完整的API文档。

Exercises

This book has exercises in some chapters. At the end of this book you can find the exercise
solutions, but I advise you to try do them yourself. Consult this book or use the comprehensive
API documentation on the official http://nodejs.org¹ website.

原文

源码

你可以在GitHub上找到本书的部分源码和练习:

https://github.com/pgte/handson_nodejs_source_code

或者直接下载它们:

https://github.com/pgte/handson_nodejs_source_code/zipball/master

Source code

You can find some of the source code and exercises used in this book on GitHub:
https://github.com/pgte/handson_nodejs_source_code²
or you can download it directly:
https://github.com/pgte/handson_nodejs_source_code/zipball/master³

原文

本书的引导方向

在阅读完本书后,你将了解Node API并可以从事研究那些基于Node所搭建出来的东西(比如适配器、框架和模块),让我们启程吧。

Where will this book lead you?

By the end of it, you should understand the Node API and be able to pursue the exploration of other
things built on top of it, being adaptors, frameworks and modules.
Let’s get started!

原文

(翻译)《Hands-on Node.js》—— Introduction的更多相关文章

  1. 翻译--Blazing fast node.js: 10 performance tips from LinkedIn Mobile

    1.避免使用同步代码: // Good: write files asynchronously fs.writeFile('message.txt', 'Hello Node', function ( ...

  2. [Node.js] Introduction to apiCheck.js

    timeoutLog.js: var apiCheckFactory = require('api-check'); var myCheck = apiCheckFactory(); module.e ...

  3. Node.js v0.10.31API手工-DNS

    原版的API品种,这是从以前的翻译和翻译风格不同 Node.js v0.10.31API手冊-文件夹 DNS 使用 require('dns') 引入此模块. dns 模块中的全部方法都使用了 C-A ...

  4. A chatroom for all! Part 1 - Introduction to Node.js(转发)

    项目组用到了 Node.js,发现下面这篇文章不错.转发一下.原文地址:<原文>. ------------------------------------------- A chatro ...

  5. [翻译] 比较 Node.js,Python,Java,C# 和 Go 的 AWS Lambda 性能

    [翻译] 比较 Node.js,Python,Java,C# 和 Go 的 AWS Lambda 性能 原文: Comparing AWS Lambda performance of Node.js, ...

  6. Node.js Addons翻译(C/C++扩展)

    PS:请先升级Node 6.2.1,Node 升级命令 npm install -g n;n stable.NOde.js扩展是一个通过C/C++编写的动态链接库,并通过Node.js的函数requi ...

  7. Jade —— 源于 Node.js 的 HTML 模板引擎

    2013-12-11 发布 Jade —— 源于 Node.js 的 HTML 模板引擎 开源项目介绍 web 模板引擎 node.js jade 207.8k 次阅读  ·  读完需要 69 分钟 ...

  8. Node.js npm 详解

    一.npm简介 安装npm请阅读我之前的文章Hello Node中npm安装那一部分,不过只介绍了linux平台,如果是其它平台,有前辈写了更加详细的介绍. npm的全称:Node Package M ...

  9. Node.js实现RESTful api,express or koa?

    文章导读: 一.what's RESTful API 二.Express RESTful API 三.KOA RESTful API 四.express还是koa? 五.参考资料 一.what's R ...

随机推荐

  1. 《Mastering.Ext.JS. 》书上主要示例都搞了个样子出来,纪念

  2. 本人为巨杉数据库(开源NoSQL)写的C#驱动,支持Linq,全部开源,已提交github

    一.关于NoSQL的项目需求 这些年在做AgileEAS.NET SOA 中间件平台的推广.技术咨询服务过程之中,特别是针对我们最熟悉的医疗行业应用之中,针对大数据分析,大并发性能的需求,我们也在慢慢 ...

  3. android的消息处理机制——Looper,Handler,Message

    在开始讨论android的消息处理机制前,先来谈谈一些基本相关的术语. 通信的同步(Synchronous):指向客户端发送请求后,必须要在服务端有回应后客户端才继续发送其它的请求,所以这时所有请求将 ...

  4. 【Cocos2d-x for WP8 学习整理】(5)文字显示全整理

    学习 Cocos2d-x 有一阵了,现在要做个小东西,第一步就遇到了文字展示的问题,于是想把可能遇到的问题统统整理一下.这一部分也不局限于wp8,全平台应该都是一个解决方案. 先在脑袋里大致想了一下, ...

  5. 传参数应该用哪种形式——值、引用、指针?

    类型:C++ & Qt4,创建时间:十二月 30, 2011, 7:43 p.m. 标题无"转载"即原创文章,版权所有.转载请注明来源:http://hgoldfish.c ...

  6. 如何快速找到排好序的数组中最先不连续的数字N

    现在有一大堆自然数组成的小到大数组arr,其中会有123456910  这样就要找到6(最先不连续的数字) 举例:[12356789] 找到3 [012345678] 找到8 第一种:遍历数组判断是否 ...

  7. F#之旅4 - 小实践之快排

    参考文章:https://swlaschin.gitbooks.io/fsharpforfunandprofit/content/posts/fvsc-quicksort.html F#之旅4 - 小 ...

  8. OpenCv ROI操作

    Mat img, dst; Rect imgroi(, , img.cols, img.rows);//小图像img需要复制到大图的像素区域rect Rect dstroi(, , img.cols, ...

  9. Beginning Scala study note(9) Scala and Java Interoperability

    1. Translating Java Classes to Scala Classes Example 1: # a class declaration in Java public class B ...

  10. python学习 1基础

    对象的等于只是对于值而言 函数定义没有变量提升 常用对象 list []: 列表, 排序省空间 tuple (): 元组,一旦初始化不可修改 dict {}: 字典,方便查询 set {}:集合, 值 ...