Skip to content

Instantly share code, notes, and snippets.

@benkoshy
Created April 14, 2017 01:03
Show Gist options
  • Select an option

  • Save benkoshy/63f20258278d3883e93de80d766b040e to your computer and use it in GitHub Desktop.

Select an option

Save benkoshy/63f20258278d3883e93de80d766b040e to your computer and use it in GitHub Desktop.
Depend on behaviour not data - blog post - part 2
# let's count the changes: 6 changes were made
# because we changed the data structure

p = Person.new({age: 20, weight: 30})
age = p.data[:age]
weight = p.data[:weight]
p1 = Person.new({age: 54, weight: 144})
p1_age = p1.data[:age]
p1_weight = p1.data[:weight]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment