今天开始会和大熊君{{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. pip 安装插件慢的解决方法

    有的时候在服务器上使用pip3安装插件比较慢. 本人非常痛苦,后经指点使用国内的源就好了...效果杠杠的... 以下为使用方法: pip3 install paramiko -i http://mir ...

  2. 攻城狮在路上(陆)-- 提交运行MapReduce程序到hadoop集群运行

    此种方式不能直接在eclipse中调试代码. 首先需要在src下放置服务器上的hadoop配置文件:core-site.xml\yarn-site.xml\hdfs-site.xml\mapred-s ...

  3. TDD学习笔记【三】---是否需针对非public方法进行测试?

    前言 在Visual Studio 2012 中,针对Unit Test 的部分,有一个重要的变动: 原本针对「测试对象非public 的部分」,开发人员可通过Visual Studio 2010 自 ...

  4. 对Raphael画图标的一个jquery简单封装

    公司要做一个项目的demo,要求地图上可以插红旗,所以就用到了Raphael. 因为是个demo,所以地图就用了一张图片,效果如下: 所以为了更好的封装一下这个功能,就写了一个简单的插件:jquery ...

  5. Java多线程之CountDownLatch学习

    给出官网上的例子:http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CountDownLatch.html Java中conc ...

  6. Spring Cloud 统一配置

    http://blog.csdn.net/catoop/article/details/50955949

  7. Unity性能优化之 Draw Call原理<转>

    Unity(或者说基本所有图形引擎)生成一帧画面的处理过程大致可以这样简化描述:引擎首先经过简单的可见性测试,确定摄像机可以看到的物体,然后把这些物体的顶点(包括本地位置.法线.UV等),索引(顶点如 ...

  8. 【HDU2896】病毒侵袭 AC自动机

    [HDU2896]病毒侵袭 Problem Description 当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻....在这样的时刻,人们却异常兴奋--我们能在有生之年看到500年 ...

  9. Hive 笔记

    DESCRIBE EXTENDED mydb.employees  DESCRIBE EXTENDED mydb.employees DESCRIBE EXTENDED mydb.employees ...

  10. bzoj1051Tarjan裸题

    tarjan缩点+判断出度为0的点 所以不需要新建边 #include <cstdio> ,time=,T=,sum=,ans=; ],to[],nex[],fir[],dfn[],low ...