Object Oriented Programming

Summary

Object oriented programming is at the heart of Ruby, and in this course we'll work on demystifying OOP and how to code in an OO fashion. We'll cover topics such as inheritance and encapsulation and get at the core of what Ruby programming is about. You'll be challenged to debug and design several non-trivial OO programs. After this course, you should know: classes and objects, instance variables, class variables, instance methods, class methods, class inheritance, working with collaborator objects, and many other basic OO concepts.

Major Topics

  • What classes and objects are
  • How class inheritance works in Ruby
  • How Ruby deals with multiple inheritance
  • Class vs instance methods and variables
  • Working with object oriented code
  • Design considerations when working with OOP
  • Object "truthiness"
  • Object equivalence
  • Fake operators in Ruby
  • Debugging OO code
  • Reading OO code
  • Working with collaborator objects
  • Modules
  • Using CRC cards to guide design
  • Over a dozen OO exercises
  • Five large OO projects

Phase

Programming and Back-end Development

Prerequisites

Detailed Syllabus

Object Oriented Programming

  • Classes and objects
  • Inheritance
  • Collaborator objects
  • Modules
  • Build an object oriented RPS game
  • Coding tips
  • CRC cards
  • RPS bonus features

Working with Objects in Ruby

  • Truthiness and equivalence
  • Variable scopes
  • Inheritance and variable scope
  • Fake operators
  • Using core libraries as a guide
  • Command vs query
  • Monkey patching
  • Struct
  • Namespacing

Exercises

  • Exercise set: Easy 1
  • Exercise set: Easy 2
  • Exercise set: Easy 3
  • Exercise set: Medium
  • Exercise set: Hard

Slightly Larger Object Oriented Programs

  • Build an objected oriented Tic Tac Toe game
  • Step by step planning and execution of the program
  • Evaluating code and making improvements
  • A small taste of software design and patterns
  • TTT bonus features
  • Build an object oriented Twenty-One game
  • Spike and overall program structure