Skip to content

Space - Katie#26

Open
ktvoort123 wants to merge 8 commits intoAda-C13:masterfrom
ktvoort123:master
Open

Space - Katie#26
ktvoort123 wants to merge 8 commits intoAda-C13:masterfrom
ktvoort123:master

Conversation

@ktvoort123
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? It runs when the .new method is called on a class (when a new instance of the class is created). It sets up the instance of that class.
Why do you imagine we made our instance variables readable but not writable? I imagine we made our instance variables readable but not writable in order to not accidentally overwrite any of the instance variables.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? The data would be stored in key value pairs rather than in instance variables, and the methods that exist within the planets class would need to be created elsewhere and changed to accommodate the new format.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? Similar to if planets were stored as hashes, the data would be stored in key value pairs rather than in instance variables. There would be nested hashes in order to store the planets information. The methods would not be able to exist within the SolarSystem class anymore.
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? I don't believe my classes follow SRP because they can do many things. For example, my SolarSystem class has methods to find planets by name, list planets, and add planets.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? I organized my 'require' statements all within my main.rb file. The require statements should be put in the file that you will actually be running.

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