Skip to content

Conversation

@npogodina
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 is called automatically when a new instance of a class is created. It takes care of any initial setup.
Why do you imagine we made our instance variables readable but not writable? To protect the instance variables from possibly being overwritten.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? We will have to create an array of planet hashes to represent the solar system and then work with this nested data structure to print/add/remove required data.
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 structure it the following way: keys will represent planet names (or alternatively planet IDs) and values will be hashes with planet details.
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? Planet class allows to store planet details and display its summary. SolarSystem class allows to add a planet to the solar system, display all added planets, find a planet by name and create a planet within the solar system. The last method prompts the user for the information, and then creates a new instance of Planet class (calls Planet constructor) and adds this planet to the system. I am not sure if this strictly follows SPR and where the best place to put this method will be, but I thought it might be nice to have a functionality to add a planet to a specific solar system in the SolarSystem class.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? The main file (which runs the program) requires files with Classes, because this is where the instances of these Classes are being created. My SolarSystem Class file also requires a file with a validation method because I am using it to validate user input within one of the SolarSystem instance methods.

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