Skip to content

Leah - Water#36

Open
scottzec wants to merge 5 commits intoAda-C14:masterfrom
scottzec:master
Open

Leah - Water#36
scottzec wants to merge 5 commits intoAda-C14:masterfrom
scottzec:master

Conversation

@scottzec
Copy link
Copy Markdown

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