Your SlideShare is downloading. ×
There's a new kid in town: node.js
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

There's a new kid in town: node.js

1,172
views

Published on

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,172
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Theres a new kid in town and his name is NodeJS Mike Amundsen @mamund
  • 2. Setting the Stage• Mike Amundsen• Goals• Non-Goals• Bottom Line
  • 3. Mike Amundsen• Presenter, Architect, Programmer• Current Focus: "Hypermedia"• Book Project ...• Designing Hypermedia APIs with HTML5 and NodeJS - O’Reilly, late 2011
  • 4. Goals• Introduce NodeJS• Talk about why NodeJS is "different"• See some NodeJS examples• Encourage you to try it out yourself
  • 5. Non-Goals• Details of downloading and installing NodeJS• Defending NodeJS programming model• Learning Javascript• Writing modules or contributing to NodeJS
  • 6. Bottom Line• NodeJS is not business as usual• Javscript is not the interesting part of NodeJS• NodeJS represents an emerging trend• You should try it!
  • 7. WAIT...
  • 8. We spend a lot of our time waiting...
  • 9. WAIT...
  • 10. For someone else to do stuff...
  • 11. WAIT...
  • 12. So we can get our stuff done.
  • 13. WAIT...
  • 14. And thats a waste of valuableresources.
  • 15. And thats a bummer!
  • 16. I wonder, is there another way to dothis?
  • 17. Ryan Dahl sez "Yes!"
  • 18. NodeJS
  • 19. Why NodeJS is Different
  • 20. Threads• Most Web frameworks use "threads" to handle work• One thread for each request• Multiple threads for concurrent execution• There is a limit to the number of threads• But as long as requests are short, its not a problem
  • 21. It used to be pretty simple...• Local files• Local database• Single data source
  • 22. But then along came the cloud...• Remote files (Amazon S3)• Remote data (SQL Azure)• Multiple data sources (Twitter, Flickr, Disqus, etc.)
  • 23. All that stuff means more waiting...
  • 24. And that means longer requests...
  • 25. And thats a bummer!
  • 26. So NodeJS does it another way• Scavenge the "wait states" as execution time• Use a single loop (queue)1. Execute a request2. Go to the next item in the queue3. Go to step 1• No more waiting!
  • 27. Its called the Reactor Pattern
  • 28. This works great for the cloudbecause...• Requests usually involve waiting• Requests are usually "side-effect free" (state-less)• Most of the "work" is done by someone else (remote servers)
  • 29. There, I fixed it!
  • 30. Wait a minute<g>; how do you codethis?
  • 31. Getting started is easy...• Starting a request is no problem• But you need to be ready when the remote server is done• You need to register a location for the returning call
  • 32. You need a "callback"
  • 33. If only there was a programminglanguage that everyone already knewthat also handled callbacks easily...
  • 34. Lets see...• Scheme• Erlang• Scala• C++• ...• Theres at least one more I know of...
  • 35. There, I fixed it again!
  • 36. Javascript is a logical choice for Node• Its already well-known (if not well-understood<g>)• There are multiple JS "engines" (Node uses V8)• Javascript already supports callbacks and closures
  • 37. So, lets review...
  • 38. So, lets review...NodeJS uses the Reactor Pattern (event loop) to takeadvantage of the extended wait-states that are now morecommon with cloud-based implementations.
  • 39. So, lets review...NodeJS uses the Reactor Pattern (event loop) to takeadvantage of the extended wait-states that are now morecommon with cloud-based implementations.And NodeJS uses Javascript on the "front-end" because itsupports callbacks/closures, is readily available, and well-known.
  • 40. Ok, lets see some code!
  • 41. NodeJS code is pretty straightforward
  • 42. NodeJS code is pretty straightforward
  • 43. Creating an HTTP file server is easy.
  • 44. Writing a file uploader is even easier.
  • 45. You can write clients w/ Node, too.
  • 46. NodeJS has a package system: npm
  • 47. Node Package Manager
  • 48. And lots of modules...
  • 49. For building full-featured applications
  • 50. Check out these resources...
  • 51. Home Page & Discussion Group• NodeJS Site (http://nodejs.org)• Discussion Group (https://groups.google.com/forum/#!forum/nodejs)
  • 52. Books & Tutorials• Hands On NodeJS (Pedro Teixeira)• Up and Running w/ Node (http://ofps.oreilly.com/titles/9781449398583/)• NodeTuts (http://nodetuts.com/)
  • 53. Online Hosting• JSApp.US (http://jsapp.us/) - *instant*• Joyent (https://api.no.de/)• Nodester (http://nodester.com/)• DotCloud (http://www.dotcloud.com/)• NodeSocket (http://www.nodesocket.com/) *nya*• NodeJitsu (http://www.nodejitsu.com/#/home) *nya*
  • 54. In Summary...
  • 55. NodeJS• Based on the "Reactor Pattern"• Uses Javascript on the front-end• Is well-suited for cloud-based implementations• Completely Open-Source (free)• Built on Linux• Windows Native port soon• Represents a growing trend
  • 56. Theres a new kid in town and his name is NodeJS Mike Amundsen @mamund