Student Example 2: Refactoring CLI Gem
Last updated
Last updated
Distinguish between Classes and their Instances
Create powerful and dynamic Scraping methods
Test and debug in console
Explain the advantages and disadvantages of the zipper pattern to combine arrays to create objects
Use user Input to display a specific Object
<iframe width="100%" height="720" src="" frameborder="0" allowfullscreen></iframe>
Objects
Class variables and properties vs instance properties
Object orientation vs functional programming
Fix the Scraper methods
The Zipper pattern
The 'Or equals' memoization
Test in the console
Pry and other debugging methods
Build reload! method to reload code changes into console
Scrape and capture properties using the zipper pattern
Create objects with those properties
Utilize these changes in our CLI Class
Scrape and persist data to objects when the app starts up
Iterate and display our Concert Objects
Fix the menu method
Use user input to grab appropriate Object
Use the Concerts.all
method to determine how many concerts we have
Array#count
method
Integer#between?
method
Check the docs for available methods for arrays
Find Concert with the Concert.find
method
Use returned Concert object to return it's attributes
Debug and fix the 'No method' error
Tips on building another application using these ideas
Tips on avoiding the Zipper pattern
Talk about the power of Object Orientation
Think about the objects in physical space
Think about method returns
Figure out average length of artist names in our data
Use iteration over Concert Objects
Talk about Array#collect
method
Tips on internalizing the concepts
Solidify concepts - move slowly!
View on Learn.co and start learning to code for free.