Mark As Completed Discussion

One Pager Cheat Sheet

  • Objects in JavaScript are based onprototypesrather than classes, so it is important to understand the distinction between class-based and prototypical inheritance.
  • JavaScript utilizes a prototype chain instead of classical inheritance to make it more powerful than traditional Object Oriented Programming.
  • Objects can be created with the Object.create() method, a built-in JavaScript method that is part of the prototype chain, allowing for more flexibility and control over objects used for programming.
  • With the introduction of the class keyword in ES6, developers have been able to create class-based inheritance models; however, the Weak Base Class problem arises when inheriting from a class which itself inherits from a superclass.
  • The Weak Base Class problem occurs when a subclass C inherits from not only its intended parent class B, but also from the parent class of B (the base class or superclass A) implicitly, which can lead to unexpected and unpredictable behaviour requiring additional efforts for addressing.
  • Prototypical inheritance allows Objects to inherit properties and methods from their prototypes, looking up the chain if needed.
  • Objects can use prototypes to inherit properties and methods from their parent object through a process known as Prototypical inheritance.
  • In software design, it is generally preferable to use composition over inheritance to achieve concatenative inheritance for better manageability and scalability.
  • Concatenative inheritance allows objects to be created from existing objects without inheriting properties from pre-existing parent-child relationships.
  • Prototypical inheritance simplifies object creation, has clear advantages over class inheritance, and solves the classic "Gorilla/Banana" problem.
  • Prototypical Inheritance involves inheriting methods or features from a prototype, while Prototype Delegation is a built-in language feature of JavaScript in which an object delegates an attribute to another object in its prototype chain.