The code in this repo is part of a walk-through sample project for the freeCodeCamp Chicago Local Study Group meetup. This project was meant as an exploration of Object Oriented programming concepts, specifically prototypal inheritance in JavaScript. This project uses the constructor invocation pattern (i.e. using constructor function objects and the new operator to create new instances of objects). This leaves opportunity to build the same project using other object creation patterns (see Additional Topics for Continued Learning/Exploration section below).
We are building a Whack-a-Mole clone game called Pet-a-Cat! This project is being built in two sessions. The first part of the project build was completed at the study group meetup on February 2nd, 2020 with the remainder of the project being built out and walked through on February 23rd, 2020.
- Create GameComponent constructor function
- Create TextComponent constructor function
- Create Scoreboard constructor function
- Create Timer constructor function
- Create a Scoreboard and Timer in the HTML
- JavaScript object creation patterns: Constructor pattern (constructor functions & using the new keyword) vs Class pattern (ES6 class syntax) vs Class Free pattern (pure objects/prototypes)
- Challenge: Re-write the game using the other patterns (Class and Class Free).
- Inheritance vs Composition
- Why should composition be favored over inheritance?
- Challenge: Write a version of the game objects using composition instead of inheritance.