Skip to content

Conversation

@ChubbyCub
Copy link

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
When does the initialize method run? What does it do? initialize method runs when I type .new. It creates a new instance of a class.
Why do you imagine we made our instance variables readable but not writable? We do not want users or people who do not have access to our classes modify the data.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? I do not use .new to create a new planet; instead, I will create a new key/value pair and add it to the hash. In addition, if I want to access information about my planets, I will have to loop through the hash instead of invoking the method summary
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? In this case, my program is not significantly different between hash and class, except for all the looping I need to perform to pull information out of the hash. If SolarSystem has some particular behaviors (not just information retrieving methods), it will be more beneficial to set it up as a class.
The Single Responsibility Principle (SRP) says that each class should be responsible for exactly one thing. Do your classes follow SRP? What responsibilities do they have? Yes, they do. The planet class represents an individual planet. The solar_system class represents a whole solar system with many planets.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? All of my require statements go on top of the ruby files. The ruby files that share methods and/or variables with other ruby files should include require statements.

@kaidamasaki
Copy link

Solar System

Great job! Your classes were clear and concise and your tests were solid. I especially liked how you made a bunch of helper methods for your main method; it made everything really easy to read and understand.

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