O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

Metaprogramming JavaScript

Próximos SlideShares
Metaprogramming with javascript
Metaprogramming with javascript
Carregando em…3

Confira estes a seguir

1 de 94 Anúncio

Mais Conteúdo rRelacionado

Diapositivos para si (20)

Quem viu também gostou (20)


Semelhante a Metaprogramming JavaScript (20)


Mais recentes (20)

Metaprogramming JavaScript

  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...