Skip to content

Conversation

@awilson2017
Copy link

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What was the purpose of the initialize method in your class? to construct the object
Describe an instance variable you used and what you used it for. @name was one of my instance variables. It was used within my object class to do stuff.
Describe what the difference would be if your SolarSystem used an Array vs a Hash. With an array we could store limited information like only name. Hashes can store many details about each planet.
Do you feel like you used consistent indentation throughout your code? yes.

@droberts-sea
Copy link

Solar System

What We're Looking For

Feature Feedback
Created Custom Class with initialize method & instance variables. Yes
Used an Array to store a list of planets in the SolarSystem class. Yes
Readable code with consistent indentation. Yes
Created a pull request with your name & the template questions answered. Mostly - "It was used within my object class to do stuff" doesn't quite meet the bar.

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

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

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

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}.

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),
]

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.

@droberts-sea
Copy link

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.

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