Object-Oriented Design

Jon Reades

Three Key Concepts for Classes

  1. Encapsulation
  2. Inheritance
  3. Polymorphism

Tree of Life

Tree of Vehicles

Most people would call this a class hierarchy or diagram.

There is no natural order here: where do e-bikes, unicycles, and rickshaws go?

Classes vs Packages

Functionally, a class and a package are indistinguishable, but a class produces objects that use methods and instance or class variables, whereas a package is a group of functions and constants that may, or may not, include classes.

Ugh, now try to keep this straight in your head.

Key Takeaways

  1. You’ve been using Classes and Methods since you started.
  2. You can ‘package up’ useful code into functions, and useful functions into packages.
  3. Together, packages and classes will turbo-charge your programming skills.
  4. You can stand on the shoulders of giants!

Resources