Skip to content

Conversation

@tanham
Copy link

@tanham tanham commented Aug 16, 2017

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What was the purpose of the initialize method in your class? to put default values into instance variables
Describe an instance variable you used and what you used it for. I used an instance variable called @planet_name to store the name of each planet
Describe what the difference would be if your SolarSystem used an Array vs a Hash. I used an array. I found it simple to iterate over my planets but I think a hash could have provided more organization for the data
Do you feel like you used consistent indentation throughout your code? yes, I periodically make use of auto-indent

@PilgrimMemoirs
Copy link

Solar System

What We're Looking For

Feature Feedback
Created Custom Class with initialize method & instance variables. Well Done
Used an Array to store a list of planets in the SolarSystem class. Well Done
Readable code with consistent indentation. Well Done
Created a pull request with your name & the template questions answered. Well Done
Overall Submission meets project expectations. Nice work!
Additional Feedback
Repeated Code In SolarSystem's print_planets_info method, you could have called Planet's print_planet_info.
Best Practices Methods should always return something. With your methods that are printing info on the planets, instead of having the 'puts' inside of the method, the methods should return the string and then 'puts' will be called when you call the method on the instance like: puts solar.print_planets_info and puts earth_object.print_planet_info
variable naming Refrain from having the class' name as part of the instance variable, in most cases it's redundant was we know this object is a planet. @name is sufficient.
object types Relating to the data being saved for each instance of planet, any sort of measurement should have consistency in what is being used (like days or kilometers). There should be consistency so that you do not have to use strings and user overly complex logic if you wanted to do math with the number. That being said, @year_length, @distance_from_sun and @diameter should be either an integer or float.
helper methods Going forward, only helper methods for reader and writer methods should be used. ex: Planet should use the attr_reader method instead of having the planets reader method manually written out.

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