Inheritance Refactor

Here you will learn about Prototypical Inheritance in JavaScript. Along the way you will learn a few common inheritance design patterns and get more experience with dependency injection.

Index


Learning Objectives

  • Inheritance
  • Inheritance design patterns

TOP


Specifications

To witness the power of inheritance we will build an application that allows users to interact with multiple data types. You will build a zoo application that allows a user to keep track of 3 types of animal:

  • kangaroos
  • orcas
  • swallows

Each animal will be stored in a separate model object.

A Zookeeper can ...

  • Feed an animal
  • Eat an animal
  • Rename an animal
  • Marry two animals
  • Buy more animals
  • Sell animals

Project:

  1. Study this markdown to explore how Prototypes work in JS
  2. Create a planning chart for your application
  3. For each story:
    1. Write tests for each module
    2. Build the application with the simplest model
  4. For each Inheritance Exercise
    1. Build the model
    2. Build an app that uses your new model
    3. Do you need to write new tests?
  5. Code reviews!

Challenge:

  • Re-implement the functionality for "super" and "extends" from ES6 Classes in ES5 using prototypes.

TOP


Resources

TOP



results matching ""

    No results matching ""