Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ports - Kim #31

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Conversation

Kimberly-Fasbender
Copy link

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
When does the initialize method run? What does it do? It runs when a new instance of a class is created, setting some data/information/etc. up immediately.
Why do you imagine we made our instance variables readable but not writable? You wouldn't want a user being able to overwrite/change the information about your solar system/planets.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? Using hashes I would have had to store my planets using key/value pairs and retrieve them using square brackets instead of dot notation. It would have been easier on the front end (setting up the planets), but harder on the back end (retrieving data for planets) using hashes.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? If my program would have stored planets in a hash instead of an array, two planets of the same name could not have been added to the planet list. Also, instead of just containing the instances themselves, I would have had to come up with keys for each instance of a planet, and retrieve them using the key.
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? I believe so. My planet class has the responsibility of creating new instances of planets. My solar system class has the responsibility of creating a solar system, by adding new instances of planets to an array that stores them.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? I organized my 'require' statements at the top of my main.rb file. It was the only file that needed them, and the other two did not. The reason for that is because I am calling the classes/methods in the main.rb file, so it is the only file that needs access to the others.

@CheezItMan
Copy link

Solar System

What We're Looking For

Feature Feedback
Overall Nice work, you hit all the learning goals for the project. See my inline notes for minor comments.

end

# method that adds a new planet to the existing solar system
def add_new_planet

Choose a reason for hiding this comment

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

I suggest moving this method to main.rb to separate the user interface role from the role tracking and organizing planets.

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