Skip to content

Instantly share code, notes, and snippets.

@chadfurman
Last active February 7, 2017 16:24
Show Gist options
  • Save chadfurman/0102c53fd4e205f51a75a500f18e9855 to your computer and use it in GitHub Desktop.
Save chadfurman/0102c53fd4e205f51a75a500f18e9855 to your computer and use it in GitHub Desktop.
notes6
  • Classical inheritance is copies

  • Coming from a C background, it's easy to see the difference with JS's inheritance

  • Objects linked to other objects, the delegation, is interesting

  • The differences between inheritance and behavior delegation

  • Kyle's methods have some small drawbacks, but 90% of the time his pattern would be good

  • If someone wants to have the classical model of inheritance, it's less a personal choice and more a tool for the problem

  • Typescript can give us this classical pattern.

  • We use classes for models, how can we use prototypes to be very useful? Especially in a webapp?

  • using .call and calling the constructor itself vs using the new keyword

  • writing .prototype feels a little strange. It's a bit simpler to use Kyle's pattern...

  • but maybe module patterns are a bit more useful

  • From having working on huge enterprise projects with different webstacks and projects that rely on classes and inheritance, this new pattern is almost impossible if the project is bigger than a simple webapp

  • There are tools/frameworks/languages (i.e. TypeScript) for these really big enterprise projects to give a real OO environment

  • Trying an enterprise application with plain prototypes / JS built-ins it will likely end up really bad

  • There are lots of hidden issues behind the scenes with enterprise apps, and it's really easy to have hidden bugs

  • Why do we use Object.create() instead of new? <-- simplification. Getting rid of new avoids confusion

  • We're still not convinced that delegation is better than the module pattern

  • The main benefit of the module pattern is hiding functionality

  • 99% of the time, we never create more than 1 instance of the heirarchy, so don't complicate things with parents/children etc

  • keeping things flat is great. Modules are great :)

  • This series is worth watching a couple of times!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment