A Note-Taking Analogy about ‘Helper Methods’ and a Few Examples

Cartoon of someone hearing a speech bubble that read’s ‘tHERE’s 4 KEY CoNCEPts… 1, 2, 3, 4'. There is a dotted line connecting the speech bubble to to the person’s brain but their brain only has a ‘mental cache’ that is 3 lines long. The dotted continues through their head and ends pointing to their hand which is taking notes.

Helper Methods Hidden in Plain Sight

Pablo Picasso ‘Girl Before a Mirror’ 1932, oil on canvas, 64 x 51 inches. A colorful, semi-abstract painting, with a representation of a woman, made up of a combination of soft shapes and horizontal lines. She looks in a mirror expressionlessly. Through abstraction there are multiple perspectives being presented at once.
class Artistattr_reader :name, :years_experience
@@all = []

def initialize(name, years_experience)
@name = name
@years_experience = years_experience
@@all << self
end

def self.all
@@all
end

def paintings
Painting.all.select{|painting| painting.artist == self}
end
end
class Artistattr_reader :name, :years_experience
@@all = []

def initialize(name, years_experience)
@name = name
@years_experience = years_experience
@@all << self
end

def self.all
@@all
end
def paintings
Painting.all.select{|painting| painting.artist == self}
end
def galleries
self.paintings.map{|painting| painting.gallery}.uniq
end
end
class Artist

attr_reader :name, :years_experience
@@all = []

def initialize(name, years_experience)
@name = name
@years_experience = years_experience
@@all << self
end

def self.all
@@all
end
def paintings
Painting.all.select{|painting| painting.artist == self}
end
def galleries
self.paintings.map{|painting| painting.gallery}.uniq
end
def proficiency
self.paintings.count.to_f / self.years_experience
end
def self.most_prolific
Artist.all.max_by{|artist| artist.proficiency}
end
end

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store