Skip to content

Conversation

@tatsqui
Copy link

@tatsqui tatsqui commented Feb 27, 2019

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
When does the initialize method run? What does it do? it runs when you call Class.new on a variable that will hold the new instance of your Class object.
Why do you imagine we made our instance variables readable but not writable? It is important design-wise to manage what variables need to be immutable and which ones should be mutable.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? We would need to access and individual planet in the hash planet[:planet_key] to find the correct instance of that planet.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? Every planet being added to the list of planets would need a key-value generated and then to access them we would loop through the list hash and output the value therein.
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 am not entirely sure that they do. I know my planet class just creates planets and planet summaries. The solar system generates a solar system and allows you to organize planets via their solar system. So I think it does follow SRP.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? The planet.rb and solar-sytem.rb files linked to main so main inherits whatever require statements are in the files that it links to. So planet and solar-system files needed require statements and main did not.

print "Cool facts about your planet: "
fun_deets = gets.chomp
new_planet = Planet.new(name: new_name, color: new_color, mass_kg: mass, distance_from_sun_km: distance, fun_fact: fun_deets)
add_planet(new_planet)

Choose a reason for hiding this comment

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

This information gathering, seeing as it is coming from the user and talking to the user, generally makes more sense as a part of main to me.

end
loop_count += 1
puts "Would you like to perform another inquiry? enter y/n"
question = gets.chomp

Choose a reason for hiding this comment

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

I don't like this! You gave me a quit option already, and if I want it, I'll use it!

@dHelmgren
Copy link

Solar System

What We're Looking For

Feature Feedback
Baseline
Whitespace (indentation, vertical space, etc) yes
Variable names yes
Git hygiene yes
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 Yes, see comment!
Overall Good job overall - this submission is well-organized and clearly hits the learning goals. 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