Skip to content

Instantly share code, notes, and snippets.

@fogus fogus/notes.md forked from frenchy64/notes.md
Created Jul 8, 2019

Embed
What would you like to do?
Notes on JavaScript prototypes

Why Objects were successful

https://www.cs.cmu.edu/~charlie/courses/15-214/2014-fall/slides/25-history-oo.pdf

  • essense of objects is (dynamic) dispatch
  • dispatch provides interoperability
  • first-class interoperability is critical to frameworks and ecosystems
  • frameworks and ecosystems are economically critical to the software industry
  • likely a significant factor in objects' success
  • Also talks about early mistakes in Simula

Why objects are inevitable

http://www.cs.cmu.edu/~aldrich/papers/objects-essay.pdf

  • Cook's definition: "An Object is a value exporting a procedural interface to data or behavior

Self: The power of simplicity

http://bibliography.selflanguage.org/_static/self-power.pdf

  • real-world vs computers: can make sweeping changes by changing shared behavior in computers

Self: organizing programs without classes

http://bibliography.selflanguage.org/_static/organizing-programs.pdf

Lua has prototypes via the metatable and __index property

https://www.lua.org/pil/16.1.html

Why prototypal inheritance matters

https://aaditmshah.github.io/why-prototypal-inheritance-matters/

Prototypal OO using JS

https://alistapart.com/article/prototypal-object-oriented-programming-using-javascript/

  • rocking chair = prototype of chair + 2 rockers
    • no blueprint needed

JS the core 2nd ed

http://dmitrysoshnikov.com/ecmascript/javascript-the-core-2nd-edition/

Crockford on Prototypes

https://crockford.com/javascript/prototypal.html

  • Crockford "invents" Object.create
    • never included in the language originally
      • original JS: new f() produces a new object that inherits from f.prototype
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.