Your SlideShare is downloading. ×
Node.js for .net developers
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Node.js for .net developers

7,169
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
7,169
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
60
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. Node.js
    For an everyday .Netweb developer
    CristianPrieto
    Senior Developer at Readify
    @cprieto/ www.cprieto.com
  • 2. Who am I?
    Senior Software developer in Readify
    Polyglot programmer
    Javascript junkie
    Very opionated
    A “web guy”
    Microsoft ASP.NET MVP
    Geek?
  • 3. What’s Node.js?
    Asynchronous event-driven I/O server-side JavaScript server supporting CommonJS and based in an event-loop engine using the Chrome’s V8 engine and libevent (and now libuv) libraries.
    Created by Ryan Dahl in 2009
    ~ 2K lines of Javascript, > 20K lines of C/C++
    It’s cancer (Ted Dziuba)
    No, it’s not (Node.js users)
  • 4. So that’s all…
    Questions?
  • 5. “Piece by piece”
    Jack the Ripper
  • 6. I/O Event-loop based server
    A tale about bunnies, hamsters and Squids…
  • 7. A hamster visiting your site
    (a happy bunny)
    Your web server
    Single threaded bunny
  • 8. Impatient hamsters
    (a busy bunny!)
    Your web server
    Single threaded bunny
  • 9. Fetching database (2s)
    Consuming Service (3s)
    Writing to a file (3s)
    Your web server
    Multi-threaded bunny
  • 10. Constantly check who is idle doing nothing or waiting
    Hyperactive squid
    Event-loop based server
  • 11. Well, That’s Node.js
  • 12. Yes… JavaScript…
  • 13. A JavaScript Server?
    It’s not a new idea, there were a lot of failed attempts out there
    You are a web developer, so you are comfortable with it, right?
    Javascript is naturally asynchronous, closure/callback function lover language
    Javascript is a hack language
    jQuery? DOM hack
  • 14. Bad code
  • 15. Good code
  • 16. Node.js components
    Core or kernel
    Very small, compact, cross platform
    Modules
    User contributed, like packages
    NPM is your friend (sorry, no Windows!)
    Core is single threaded
    Modules spawn new process or threads
    But you should not care about that
    Core “automatically” load balance between cores/cpu’s
  • 17. Some useful modules
    Network modules
    Http, Net, Dns, smtp, Socket.IO
    Web framework modules
    Express, Fab.js
    Testing
    Vows, jasmine-node, Cup of Tea
    Database connection modules
    File servers, payment, graphics
  • 18. But I’m a Windows developer
    Microsoft loves JavaScript
    Microsoft loves Node.js
    Microsoft is going to deploy Node.js
    Bing is hiring Node.js devs
    Joyent is improving Node.js on Windows
    IIS loves Node.js
    IISNode
    IISNode Express
    Webmatrix loves Node.js
    Node.js templates for Webmatrix
  • 19. Warning… JavaScript ahead!
    demo
  • 20. Not everything is gold
    When to use Node.js
    I/O heavy processes
    Chatty protocols
    Execution pipes
    When not to use Node.js
    Computer intensive operations (but…)
    Memory intensive operations (1.2G stack)
    You still afraid of JavaScript
  • 21. Ok, nice, I got it…
    But I’m a .Net developer
  • 22. Surprising Fact
    Most Unix developers don’t do Windows
  • 23. We can do it
    IO Completion Ports (IOCP), WinNT 3.5
    IIS uses it since IIS5.0
    IHttpAsyncHandler (since 2003!)
    IO threads are not Worker threads
    Eventing, declarative instead of imperative
    ASP.NET 4.5 supports
    AsyncHttpHandlers
    AsyncHttpModules
    Async MVC Controllers
    C# 5.0 async/await
  • 24. Threads are not magic
    So “new Thread” it’s not a magical wand
    Context switching it’s not free
    Tasks != Threads
  • 25. What should I do now?
    Go and learn JavaScript
    Go and “play” with Node.js
    Go and read a good async book
    Don’t use threads as your hammer
    Understand threading implications
    Realize there is not a single powerful language
    Buy me a coffee
  • 26. Thanks!
    Questions?