-
Notifications
You must be signed in to change notification settings - Fork 43
Create Pipes - Angela - solar_system.rb #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Solar SystemWhat We're Looking For
This is a good start. While it's true that you didn't get all the UI work for wave 3, it seems like you hit the learning goals around working with objects, which are the most important goal for this project. I've included some specific comments inline below. |
|
|
||
| def name_of_planet | ||
| return @name | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you've got attr_reader :name up top, you don't really need this method. Instead of saying planet.name_of_planet, a caller could just use planet.name.
| def planets_name | ||
| list_planet_names = "#{@name}\n" | ||
|
|
||
| return list_planet_names |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the dedication to making things into methods, but this is probably overkill. In general, you should leave output formatting (like putting newlines at the end of strings) to parts of your code dedicated to interacting with the user.
| solar_system_output = "" | ||
| @solar_system.each do |planet_object| # planet_object represents a new planet instance | ||
| #add to planet_output string | ||
| solar_system_output += planet_object.planet_output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, I like that you call the existing planet_output method on the Planet class. Makes this method concise and readable.
|
|
||
| def planet_detail | ||
| planet_details = " | ||
| #{@name}'s volume = #{@volume}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method looks very similar to planet_output above? Could you combine the two somehow?
| planets_wave_2 = [ | ||
| Planet.new("Angela", 15, 20, "no", 1), | ||
| Planet.new("Tamira", 10, 2, "yes", 2), | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that you put your collection of planets directly into an array here rather than assigning each to its own variable. That makes it clear to the reader that the planets will only be used through the collection, not individually, and saves you having to come up with variable names.
|
This looks good! I'm glad you had the time to go back and make these changes - it's a great learning opportunity, but so often in a course like this as soon as one assignment is finished we're immediately off to the next thing. |
Solar System
Congratulations! You're submitting your assignment.
Comprehension Questions
initializemethod in your class?SolarSystemused anArrayvs aHash.