0
Using JavaScript          in Today’s World          Sudar Muthu          Research EngineerGO BIG!          Yahoo! Labs    ...
What is JavaScript?
World’s most popularprogramming language     Douglas Crockford -     http://javascript.crockford.com/popular.html
World’s most    misunderstoodprogramming language     Douglas Crockford -     http://javascript.crockford.com/popular.html
Who am I?To talk about JavaScript
Fan of Douglas Crockford http://wp.me/p4WjA-pe
The JavaScript wedding     invitation guy ;) http://wp.me/p4WjA-rK
Using JavaScript inthe browser
Options•   YUI•   jQuery•   MooTools•   Backbone.js•   Knockout.js•   .. and a million others
When to use YUI• You already know what JavaScript is• To build full-fledged websites that  have numerous components with  ...
When to use jQuery• If you are new to JavaScript• Want something that is light• Have a simple website with lesser  number ...
When to use backbone.js• Decouple data from the UI• Use a full fledged MVC in the client  side as well• Want to have multi...
Other special purpose libraries• Lime.js – HTML5 based game  framework• Processing.js – Data visualizations  and interacti...
Using JavaScript inthe server
Why JavaScript on the server• Homogenous Programming  Experience• Easy meta programming• Easy reflection• Object literals•...
What is node.js•   Event-driven•   Non-blocking I/O•   Asynchronous•   Single-threaded•   Light weight and efficient
Why node.jsCode like thisvar result = db.query("select..");// use resulteither blocks the entire process orimplies multipl...
Why node.jsBut a line of code like thisdb.query("select..", function (result){      // use result});allows the program to ...
Demo
Demo of callback// execute the callback after 2 secondssetTimeout(function () {    console.log("World!");}, 2000);// print...
Demo of a server in node.jsvar http = require(http); // require the http module// create a serverhttp.createServer(functio...
When to use node.js• Writing highly concurrent server  applications• Sharing application logic between  server and client•...
Other options to consider•   Rhino•   Spidermonkey•   Narwhal•   Nitro
Using JavaScript inmobile applications
PhoneGapHTML5 app platform that allows you towrite native mobile applications usingweb technologies like HTML andJavaScrip...
When to use it?If you need to have one code base anddevelop mobile applications for•   Android•   iOS•   Blackberry•   Win...
Using JavaScript indesktop applications
Some options to consider•   Windows metro apps•   Yahoo Konfabulator•   Cappuccino•   Titanium•   Couch DB
Other exoctic use cases• Control USB hid devices – node-hid• Control Serial devices – node-  serialport• Control Arduino –...
Well, it’s all fine,  but I don’t likeJavaScript Syntax
Then useCoffeeScript
Demo
Questions      Sudar Muthu      http://sudarmuthu.com      http://twitter.com/sudarmuthu
Upcoming SlideShare
Loading in...5
×

Using Javascript in today's world

2,238

Published on

A brief about different JavaScript frameworks and some suggestions on when to use each one of them. More details at http://sudarmuthu.com/blog/slides-from-my-talk-about-using-javascript-at-teched

Published in: Technology

Transcript of "Using Javascript in today's world"

  1. 1. Using JavaScript in Today’s World Sudar Muthu Research EngineerGO BIG! Yahoo! Labs http://sudarmuthu.com http://twitter.com/sudarmuthu
  2. 2. What is JavaScript?
  3. 3. World’s most popularprogramming language Douglas Crockford - http://javascript.crockford.com/popular.html
  4. 4. World’s most misunderstoodprogramming language Douglas Crockford - http://javascript.crockford.com/popular.html
  5. 5. Who am I?To talk about JavaScript
  6. 6. Fan of Douglas Crockford http://wp.me/p4WjA-pe
  7. 7. The JavaScript wedding invitation guy ;) http://wp.me/p4WjA-rK
  8. 8. Using JavaScript inthe browser
  9. 9. Options• YUI• jQuery• MooTools• Backbone.js• Knockout.js• .. and a million others
  10. 10. When to use YUI• You already know what JavaScript is• To build full-fledged websites that have numerous components with interdependent dependencies• You need lot of build-in widgets• Need to use design patterns• Need to have a maintainable code
  11. 11. When to use jQuery• If you are new to JavaScript• Want something that is light• Have a simple website with lesser number of components• Need a quick solution and want something that is easier to learn
  12. 12. When to use backbone.js• Decouple data from the UI• Use a full fledged MVC in the client side as well• Want to have multiple views/clients (mobile, desktop, tablets etc)• You have a clear understanding of JavaScript and also the MVC concepts
  13. 13. Other special purpose libraries• Lime.js – HTML5 based game framework• Processing.js – Data visualizations and interactive animations• flot – JavaScript plotting library• Raphael – Vector graphics library
  14. 14. Using JavaScript inthe server
  15. 15. Why JavaScript on the server• Homogenous Programming Experience• Easy meta programming• Easy reflection• Object literals• Interpreted Langauge
  16. 16. What is node.js• Event-driven• Non-blocking I/O• Asynchronous• Single-threaded• Light weight and efficient
  17. 17. Why node.jsCode like thisvar result = db.query("select..");// use resulteither blocks the entire process orimplies multiple execution stacks(threads).
  18. 18. Why node.jsBut a line of code like thisdb.query("select..", function (result){ // use result});allows the program to return to theevent loop immediately. No moreunnecessary threads.
  19. 19. Demo
  20. 20. Demo of callback// execute the callback after 2 secondssetTimeout(function () { console.log("World!");}, 2000);// print in consoleconsole.log("Hello");https://github.com/sudar/jsfoo/blob/master/callback.js
  21. 21. Demo of a server in node.jsvar http = require(http); // require the http module// create a serverhttp.createServer(function (req, res) { // call this function when a request is received res.writeHead(200, { Content-Type: text/plain }); // send this as part of the response res.end(Hello Worldn);}).listen(1337, "127.0.0.1"); // listen on port 1337// debug informationconsole.log(Server running at http://127.0.0.1:1337/); https://github.com/sudar/jsfoo/blob/master/http-server.js
  22. 22. When to use node.js• Writing highly concurrent server applications• Sharing application logic between server and client• Peer-to-peer web applications using websockets• And node.js is available in Azure
  23. 23. Other options to consider• Rhino• Spidermonkey• Narwhal• Nitro
  24. 24. Using JavaScript inmobile applications
  25. 25. PhoneGapHTML5 app platform that allows you towrite native mobile applications usingweb technologies like HTML andJavaScriptYes it works in Windows Phone 7 aswell
  26. 26. When to use it?If you need to have one code base anddevelop mobile applications for• Android• iOS• Blackberry• Window Phone• etc
  27. 27. Using JavaScript indesktop applications
  28. 28. Some options to consider• Windows metro apps• Yahoo Konfabulator• Cappuccino• Titanium• Couch DB
  29. 29. Other exoctic use cases• Control USB hid devices – node-hid• Control Serial devices – node- serialport• Control Arduino – noduino• Control Powerpoint presentations
  30. 30. Well, it’s all fine, but I don’t likeJavaScript Syntax
  31. 31. Then useCoffeeScript
  32. 32. Demo
  33. 33. Questions Sudar Muthu http://sudarmuthu.com http://twitter.com/sudarmuthu
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×