$30 off During Our Annual Pro Sale. View Details »

Hungarian Webkonf: Why Node.js?

Hungarian Webkonf: Why Node.js?

My talk for the Hungarian webkonf, targeting newcomers to get a feeling of node.js and inspire them to learn it.

http://risingstack.com

Gergely Nemeth

November 09, 2014
Tweet

More Decks by Gergely Nemeth

Other Decks in Technology

Transcript

  1. Why Node.js?
    #webkonf
    Gergely Nemeth
    @nthgergo

    View Slide

  2. WHOAMI
    nodebp.com
    oneshot.risingstack.com
    risingstack.com

    View Slide

  3. JAVASCRIPT
    - created in 1995
    - runs in every major browser
    - prototype-based, dynamic typing, first-
    class functions

    View Slide

  4. JAVASCRIPT

    View Slide

  5. JAVASCRIPT
    not just the language of the browser any more

    View Slide

  6. FIRST-CLASS CITIZEN IN OSX

    View Slide

  7. INTERNET OF THINGS

    View Slide

  8. IN THE CLOUD

    View Slide

  9. NODE.JS
    “for easily building fast, scalable network
    applications”

    View Slide

  10. NODE.JS
    - V8

    View Slide

  11. NODE.JS
    - V8
    - nonblocking I/O

    View Slide

  12. NODE.JS
    Blocking I/O
    the traditional way
    Nonblocking I/O
    the Node.js way

    View Slide

  13. NODE.JS
    - V8
    - nonblocking I/O
    - event driven

    View Slide

  14. NODE.JS
    - V8
    - nonblocking I/O
    - event driven
    - single threaded

    View Slide

  15. CALLBACKS
    fs.readFile('/file', function(err, data) {
    if (err) throw err;
    console.log(data);
    });

    View Slide

  16. SOME OF THE ADOPTERS…

    View Slide

  17. THE PAYPAL CASE-STUDY
    existing Java stack

    View Slide

  18. THE PAYPAL CASE-STUDY
    Java and Node in parallel

    View Slide

  19. THE PAYPAL CASE-STUDY
    One Language to Rule them all

    View Slide

  20. THE PAYPAL CASE-STUDY
    Now all new apps at PayPal are written in
    Node.

    View Slide

  21. THE PAYPAL CASE-STUDY
    - Headcount: from ⅓ to 1/10
    - Performance: 10x throughput in scale
    - Lines of code: code size shrink by factor of
    3-5

    View Slide

  22. HOW?

    View Slide

  23. View Slide

  24. NPM
    - open repository for Node modules
    - proper SemVer
    - more than 100.000 modules
    - open source all the things!

    View Slide

  25. NPM
    Would be nice to use all this in the browser as
    well?

    View Slide

  26. View Slide

  27. BROWSERIFY
    - require('modules') in the browser
    - bundling up all of your dependencies from
    the node_modules dir
    - does not pollute the global scope
    http://blog.risingstack.com/publishing-your-first-browserify-node-module/

    View Slide

  28. BROWSERIFY
    // main.js
    var $ = require('jquery');
    $('body').append('Hello Browserify!');
    npm install jquery --save
    browserify main.js -o bundle.js

    View Slide

  29. Which brings us to...

    View Slide

  30. ISOMORPHIC JAVASCRIPT
    http://blog.risingstack.com/from-angularjs-to-react-the-isomorphic-way/

    View Slide

  31. Thanks!
    Gergely Nemeth
    @nthgergo

    View Slide