node lesson6

https://nodejs.org/docs/latest/api/process.html#process_process_argv

https://github.com/alsotang/node-lessons/tree/master/lesson6

 http://blog.csdn.net/csr0312/article/details/47044259

var fibonacci  = function(n){
    if(n === 0) return 0;
    if(n === 1) return 1;
    return fibonacci(n-1) + fibonacci(n-2);
}

if(require.main === module){
    // 如果是直接执行 main.js,则进入此处
    // 如果 main.js 被其他文件 require,则此处不会执行。
    var n = Number(process.argv[2]);
    //An array containing the command line arguments.
    //The first element will be 'node', the second element will be the name of the JavaScript file.
    //The next elements will be any additional command line arguments.
    console.log('fibonacci(' + n + ') is ', fibonacci(n));
    console.log(process.argv);
}

 Behavior Driven Development,行为驱动开发是一种敏捷软件开发的技术,它鼓励软件项目中的开发者、QA和非技术人员或商业参与者之间的协作。BDD最初是由Dan North在2003年命名,它包括验收测试和客户测试驱动等的极限编程的实践,作为对测试驱动开发的回应。在过去数年里,它得到了很大的发展。

测试驱动开发,英文全称Test-Driven Development,简称TDD,是一种不同于传统软件开发流程的新型的开发方法。它要求在编写某个功能的代码之前先编写测试代码,然后只编写使测试通过的功能代码,通过测试来推动整个开发的进行。这有助于编写简洁可用和高质量的代码,并加速开发过程。

posted @ 2015-10-10 14:53  darr  阅读(158)  评论(0编辑  收藏  举报