Skip to content

Leaves - Emily Vomacka#34

Open
emilyvomacka wants to merge 12 commits intoAda-C12:masterfrom
emilyvomacka:master
Open

Leaves - Emily Vomacka#34
emilyvomacka wants to merge 12 commits intoAda-C12:masterfrom
emilyvomacka:master

Conversation

@emilyvomacka
Copy link

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
When does the initialize method run? What does it do? The initialize method runs whenever you create a new planet or solar system using .new. It creates a new instance of the class to which it belongs.
Why do you imagine we made our instance variables readable but not writable? It's not beneficial to let users rewrite theoretically verified, theoretically scientific facts.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? We could write and reference planet characteristics as key-value pairs, instead of instance variables. We would need to rewrite methods to use the new structure.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? We would have to change the organization of the planet class to fit it into a key-value framework. We would again need to rewrite methods to use the new structure.
There is a software design principle called the SRP. The Single Responsibility Principle (SRP) says that each class should be responsible for exactly one thing. Do your classes follow SRP? What responsibilities do they have? I think so? The planets are responsible for storing/referencing their planet data, and the solar system is responsible for storing/referencing an array of planets.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? Class files (i.e. solar_system.rb) require the files for other classes that contribute to their composition (i.e. planets.rb). I required both solar_system and planets in my main file, but it seems that nothing breaks if you remove planets from main's requirement list, so I think as long as there is a 'require' trail from the main file to all necessary classes (even through other files, like solar_system.rb) everything should work.

# pluto = Planet.new('Pluto', 'blue', 1000, 10, 'it is a controversial planet pick')
# solar_system.add_planet(pluto)

# kuiper_belt = Planet.new('Kuiper Belt', 'gray', 10, 19, 'it is not a planet at all just rocks')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove these comments from your code! With git, these changes aren't lost, just buried!

new_planet_color = gets.chomp
puts "What is the new planet's mass in kg?"
new_planet_mass = gets.chomp.to_i
puts "What is the new planet's distance from the sun in km?"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see these larger sections broken out into helper methods!

# score = blackjack_score(hand)

# # Assert
# expect(score).must_equal 14

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's totally cool to pull up scratch work, just remember to remove it! It's confusing!

@dHelmgren
Copy link

Solar System

What We're Looking For

Feature Feedback
Baseline
Whitespace (indentation, vertical space, etc) yes
Variable names yes
Git hygiene great!
Planet
initialize method stores parameters as instance variables with appropriate reader methods yes
summary method returns a string yes
SolarSystem
initialize creates an empty list of planets yes
add_planet takes an instance of Planet and adds it to the list yes
list_planets returns a string yes
find_planet_by_name returns the correct instance of Planet yes
CLI
Can list planets and quit yes
Can show planet details yes
Can add a planet yes
Complex functionality is broken out into separate methods see comments
Overall Great job overall! I have a few comments, but it's clear the learning goals were met! Keep up the hard work!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants