Object Oriented Programming with JavaScript

Summary

Object oriented programming (OOP) is at the heart of most software development. Though JavaScript is a bit unusual in its approach to OOP, it is nevertheless an OOP language. In this course, we'll work on demystifying OOP and how to code in an OO fashion. We'll look at how JavaScript's functions are first class objects, and how that gives us the ability to use callbacks and function expressions. We'll also explore the extremely important concept of execution context, dealing with context loss, and how to bind functions to specific context objects. We'll cover the cornerstone concepts of OOP as they apply to JavaScript, namely prototypal inheritance, encapsulation, and polymorphism. You'll be challenged to debug and design several non-trivial OO programs using Node.js. After this course, you should know and understand objects, properties, methods, prototypal inheritance, factory functions, constructors, ES6 classes, and the OLOO pattern, as well as many other basic OO concepts.

Major Topics

  • What are objects
  • How inheritance works in JavaScript
  • How JavaScript deals with multiple inheritance
  • Object properties and methods
  • Working with object oriented code
  • Design considerations when working with OOP
  • Function expressions
  • Higher Order Functions
  • The Global Object
  • Execution Context and dealing with context loss
  • Factory Functions
  • Object Prototypes
  • Constructors
  • Classes
  • Projects and Exercises

Phase

Programming and Back-end Development

Detailed Syllabus

Introduction to Object Oriented Programming

  • What is OOP?
  • Encapsulation
  • Creating objects
  • Collaborator objects
  • Functions as Object factories
  • Build an OO Rock, Paper, Scissors game
  • Rock, Paper, Scissors bonus features
  • ESLint RPS
  • RPS bonus features
  • Practice problems

Functions, Objects, and Prototypes

  • Object prototypes
  • Function expressions
  • Higher order functions
  • The global object
  • Implicit and explicit execution context
  • Hard binding functions with contexts
  • Dealing with context loss
  • Practice problems

Object Creation Patterns

  • Constructors
  • Constructors with prototypes
  • Constructors as functions and the prototype property
  • Static and Instance Properties and Methods
  • Built-in constructors
  • ES6 classes

Subclassing and Code Reuse Patterns

  • Object creation with prototypes (OLOO)
  • Subtyping with constructors and prototypes
  • Subtyping with Classes
  • Rewriting OO Rock, Paper, Scissors game with constructors and classes
  • Code reuse with mixins
  • Polymorphism

More Object Oriented Programming

  • Build an OO Tic Tac Toe game with classes
  • Build an OO Tic Tac Toe game with constructors and prototypes
  • Build an OO Tic Tac Toe game with OLOO
  • Build an OO Tic Tac Toe game bonus features
  • Build an OO 21 game

Assessment

  • Assessment Format
  • Study Guides
  • The Exam
  • The Interview
  • Feedback