Skip to content

Conversation

@amb54
Copy link

@amb54 amb54 commented Feb 15, 2017

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What was the purpose of the initialize method in your class? It initialize all local variables for the class
Describe an instance variable you used and what you used it for. I used @Age, that is the age for our solar system (in earth years) passed into the class SolarSystem. It was used to calculate the local age for a given planet via the method local_age.
Describe what the difference would be if your SolarSystem used an Array vs a Hash. If one would have use a hash instead of an array, the keys in the hash could represent the Planet objects. In this case an array is used and a method is created to return the Planet object of interest.
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 & a meaningful message. yes

Excellent work on the optionals!

attr_accessor :radius, :mass, :sattelites, :stellar_day, :distance_from_sun, :orbital_period
attr_reader :name
attr_reader :distance_unit, :mass_unit, :day_time_unit, :year_time_unit
def initialize(planet_hash)

Choose a reason for hiding this comment

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

Good job re-working Planet#initialize to take a hash.

end

# Method that returns a Planet object corresponding to a specific planet name
def planet_object(planet_name)

Choose a reason for hiding this comment

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

Nicely done.

I'd like you to pay close attention to what you name things (variables, methods, classes, etc.) as we go forward. planet_object doesn't really give a hit for what this method does.

Since a method typically does some action, a verb-phrase is usually a good choice. Something like lookup_by_name would be good here.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants