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

Earth - Beauttie #31

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

Earth - Beauttie #31

wants to merge 6 commits into from

Conversation

beauttie
Copy link

Assignment Submission: Solar System

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

Question Answer
When does the initialize method run? What does it do? When you use the .new method on a class name, it constructs an instance of the class with the given arguments.
Why do you imagine we made our instance variables readable but not writable? So that the user cannot modify the value of our instance variables.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? The .summary method would get the value of its corresponding attribute with its key.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? I would need to modify the value of @planets in the constructor to be an empty hash and the body of my add_planet method to @planets[:name] = planet.name. I would also need to iterate over key-value pairs in the list_planets and find_planet_by_name methods.
There is a software design principle called the SRP. 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, my classes followed SRP because the Planet class was responsible for reading out information about a planet and the SolarSystem class for managing information about a collection of planets.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? I put them at the top of my Ruby files. Files that needed a "require" statement used a method from the class referenced.

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.

1 participant