Skip to content

Instantly share code, notes, and snippets.

@screamingmunch
Last active December 18, 2015 19:38
Show Gist options
  • Save screamingmunch/5834077 to your computer and use it in GitHub Desktop.
Save screamingmunch/5834077 to your computer and use it in GitHub Desktop.
MVC/Testing, Classes, Modules

MVC/ Test Classes Modules Lab

we've installed oh-my-zsh for the terminal (in addition to pry that we had before): https://github.com/robbyrussell/oh-my-zsh

--- Type Class
1, 2, 3 number FixNum
1.5 number Float

Objects- has data & behavior Classes- objects, data, methods
Lauren's analogy: a class is similar to an email template, and every time you create a class.new, you're creating a new "instance" of the class.. i.e. you're creating a new email with the same default lines (methods in the class) and so on.

Homework Review- Flickr hash

9   image = []
10  items.each { |img_hash|
11    image << Images.new(img_hash)
12  }
13
14# image = items.map { |img_hash|
15#   Images.new(img_hash)
16# }
17# The above .map function is equivalent to Lines 9-12
18#

pre-optimization is a root of all evil. Best to leave functions that the user may or may not perform as methods, as opposed to initialization. You want the program to be as lazy as possible. "Don't go out with a shovel unless you know there's snow in the driveway."

Approaching problems: not so much how do I know how to solve the problem, more of "how would I know if the problem is solved?"

Start with the most discrete (most self-contained) problems, ones that doesn't have as much dependencies on other variables.

prism

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment