Metaprogramming JavaScript

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

5 comments

Comments 1 - 5 of 5 previous next Post a comment

Post a comment
Embed Video
Edit your comment Cancel

56 Favorites & 3 Groups

Metaprogramming JavaScript - Presentation Transcript

  1. Metaprogramming JavaScript Dan Webb (dan@danwebb.net)
  2. What? “ the writing of computer programs that write or manipulate other programs (or themselves) as their data”
  3. With JavaScript?! ★ Small and fiesty but widely misunderstood ★ Relies on few but powerful constructs ★ You can work with functions, arguments, built-ins types and mechanisms like inheritance at runtime ★ Techniques underpin many JS libraries
  4. JavaScript Exposed: Objects Out Of Control!
  5. Play along!
  6. 4 building blocks
  7. (Nearly) everything is a hash
  8. number string boolean undefined
  9. everything else is an Object
  10. This works with any object
  11. Expandos: a special case
  12. Inspecting objects
  13. Inspecting types
  14. Wha?!
  15. First typeof then instanceof
  16. Functions are Objects
  17. 'Methods' are just functions that are assigned to a property of an object
  18. arguments
  19. Functions can return other functions
  20. Closure
  21. Back to wikipedia... “ A closure occurs when a function is defined within another function, and the inner function refers to local variables of the outer function.
  22. Why is that useful?
  23. Functions can be used to make objects
  24. Constructor functions are just functions
  25. The magic is in the new operator
  26. inheritance
  27. The point is: its all just functions, objects and properties
  28. We can hack it all.
  29. So what can you do with this stuff?
  30. Patch holes in bad implementations
  31. Self optimising code
  32. Pretty APIs
  33. Domain Specific Languages
  34. DOMBuilder http://danwebb.net/lowpro
  35. DIY language features
  36. John Resig's method overloading http://ejohn.org/blog/javascript-method-overloading/
  37. Prototype 1.6 Classes http://prototypejs.org/learn/class-inheritance
  38. and a lot more...
  39. Looking back... ★ JavaScript is small but totally flexible ★ A handful of techniques provide everything you need ★ It's all about objects, properties and functions ★ Don't worry if its not all sunk in. Have a play around. Slides will be available.
  40. Coming Soon...

+ danwrongdanwrong, 2 years ago

custom

26350 views, 56 favs, 34 embeds more stats

As presented at @media Ajax in London on the 20th N more

More info about this document

© All Rights Reserved

Go to text version

  • Total Views 26350
    • 24006 on SlideShare
    • 2344 from embeds
  • Comments 5
  • Favorites 56
  • Downloads 1081
Most viewed embeds
  • 1675 views on http://www.danwebb.net
  • 405 views on http://www.sitepoint.com
  • 91 views on http://www.coderholic.com
  • 47 views on http://www.mutationevent.com
  • 28 views on http://charlie-blog.com

more

All embeds
  • 1675 views on http://www.danwebb.net
  • 405 views on http://www.sitepoint.com
  • 91 views on http://www.coderholic.com
  • 47 views on http://www.mutationevent.com
  • 28 views on http://charlie-blog.com
  • 24 views on http://www.rolandpoulter.com
  • 10 views on http://dixionjavascript.blogspot.com
  • 9 views on http://static.slideshare.net
  • 5 views on http://www.dowling.me.uk
  • 5 views on http://www.netvibes.com
  • 5 views on http://www.squiz.co.uk
  • 4 views on http://www.danwebb.net.sharedcopy.com
  • 4 views on http://argus.tistory.com
  • 4 views on http://tumble.derbumi.com
  • 3 views on http://www.charlie-blog.com
  • 3 views on file://
  • 2 views on http://www.filescon.com
  • 2 views on http://eldercarerobot.com
  • 2 views on http://rss.sitepoint.com
  • 2 views on http://maidbots.com
  • 1 views on http://freewimaxservice.net
  • 1 views on http://botsales.com
  • 1 views on http://uptolife.blogspot.com
  • 1 views on http://www.rapidsharefast.com
  • 1 views on http://tumblr.rolandpoulter.com
  • 1 views on http://64.233.167.104
  • 1 views on http://s3.amazonaws.com
  • 1 views on http://www.hanrss.com
  • 1 views on http://209.85.129.104
  • 1 views on http://www.thinkingphp.org
  • 1 views on http://cache.baidu.com
  • 1 views on http://gmodules.com
  • 1 views on http://www.slideshare.net
  • 1 views on http://rhio.tistory.com

less

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel
File a copyright complaint
Having problems? Go to our helpdesk?

Categories