Skip to content

Conversation

@faezeh-ashtiani
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 we create and instance of a new class. if helps to setup the basic state of the instances of the class.
Why do you imagine we made our instance variables readable but not writable? because we did not want anyone to accidentally overwrite the information about a given instance of planet or solar system
How would your program be different if each planet was stored as a Hash instead of an instance of a class? we would have had one file if all the data, and keeping track of that file and maintaining it would have become more difficult.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? depending on what type of keys we would have used in that hash, we would have had to access the information inside the hash differently. for example the hash keys could have been planet_1:, planet_2:, etc. an the values would have been the entire instance of Planet ; or each argument of the instance of Planer class could have had it's own key for example @planets = { "name" => {"Earth", "Mercury",...}, "color" => {"blue-green", "red",...}, ....}.
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 think they follow SRP. the class Planet is responsible for storing the information on 5 different aspects of and instance of a planet and allowing that information to be retrieved. SolarSystem class is responsible for storing a list of planets that exists in one instance of a SolarSystem and allowing that information to be retrieved.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? I used 'require' in the test file for loading in the necessary gems when running. I used 'require relative' in the main file and test file so that the necessary files that needed to be read from within those files could be reached.

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