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

Leah - Water #36

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

Leah - Water #36

wants to merge 5 commits into from

Conversation

scottzec
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? The initialize method runs when I initialize an instance of the Planet or SolarSystem class. It determines what basic info is then assigned to the class instance, making it smoother for me as the code writer, and it also makes sure that the important pieces, like the name of a planet, aren't missing when creating this instance).
Why do you imagine we made our instance variables readable but not writable? So the user on the CLI can view the planets in my solar system and learn all about them, but isn't able to tamper with that information.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? It would be a more overwhelming nested data structure. This way is much cleaner. The file where the actual program is (not the classes) is therefore much shorter (and probably has many fewer mistakes on its way to creation).
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? It would be a different data structure and require accessing the planet data through an extra layer.
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? No. Planet can create a planet and create a summary of each planet. Solar System can do various things to the solar system: add a planet, list planets, etc. Unless "one thing" means one topic.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? Only main.rb requires these statements because it calls on the files containing Classes.

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