Skip to content

Conversation

@JNEdrozo
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? Initialize is a constructor. When the .new method is used, the initialized method is automatically called to construct an instance of a class. (It may require us to enter certain values for arguments or instance variables before constructing an object).
Describe an instance variable you used and what you used it for. In the SolarSystem Class, I used the @planets instance variable to store the planets array (which already had default values).
Describe what the difference would be if your SolarSystem used an Array vs a Hash. Currently my SolarSystem class passes an array in which its elements are a list of planet class objects. To access the planets' attributes (e.g. name, year_length, etc.), I would apply the planet's reader methods (e.g. .name, .year_length) to access its values for each element. Now, if each planet were a hash consisting of 5 other hashes, to get access to those attribute values, I would have to use the hash key (e.g. :name) as shown in this example: https://repl.it/KKMv/13
Do you feel like you used consistent indentation throughout your code? yes

@JNEdrozo JNEdrozo changed the title Create solar_system.rb Jan Edrozo - Carets Aug 16, 2017
@tildeee
Copy link

tildeee commented Aug 21, 2017

Solar System

What We're Looking For

Feature Feedback
Created Custom Class with initialize method & instance variables. x
Used an Array to store a list of planets in the SolarSystem class. x
Readable code with consistent indentation. x
Created a pull request with your name & the template questions answered. x

@tildeee
Copy link

tildeee commented Aug 21, 2017

Your code is good! I like the names you gave all of your methods-- it makes your code easy to understand.

Maybe a way to refactor in the future is to find a way to check if planet_response is equal to any name in the Solar System through iteration.

Good 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