Video Review: Object Models

Permalinkarrow-up-right

Join GitHub today

GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Sign uparrow-up-right

24 lines (17 sloc) 1.35 KB

Overview

This video gives an overview of object models and how to make our classes more powerful.

Objectives

  • Create a class and add reader and writer methods

  • Define class methods with an explicit self receiver

  • Capture new instances of self in the initialize method

  • Use a class variable or constant to hold the instances of the class

  • Explain why we avoid using the return keyword from within a loop

  • Define a find_by_location method to find a particular instance of a class

  • Abstract the logic of the find_by_location method to a detect enumerable method

  • Define a class method find_all_by_location to find all instances with that location using the select enumerable method

  • Define a custom constructor method to create instances from attributes scraped from a website

<iframe width="100%" height="720" src="https://www.youtube.com/embed/vENMFapLonA?rel=0&showinfo=0arrow-up-right" frameborder="0" allowfullscreen></iframe>

Resources

Additional Video on Object Modelsarrow-up-right

  • This video also covers many of the above topics in the main lesson video. Feel free to use this as another refresher on object models.

View OO Ruby Video Review: Object Modelsarrow-up-right on Learn.co and start learning to code for free.

Last updated