Skip to content

Conversation

@snowistaken
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 invoked when a new class object is created. This method initializes instance variables.
Why do you imagine we made our instance variables readable but not writable? We made our instance variables readable but not writable due to the fact that if they were writable other users of the code would be capable of overwriting information necessary to the success of the program without realizing it.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? The program would be very decentralized and much more difficult to read, as all of the class methods for planet such as summary would have to be implemented elsewhere.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? As with the differences of using the planet class as a hash, none of the methods written in the SolarSystem methods would be available to be easily called upon the solar_system object.
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 do think that my classes follow SRP. The responsibilities of the Planet class involve storing all information relevant to the instance of each planet, as well as returning a formatted summary of that information when called. The SolarSystem class is responsible for storing a collection of planet instances, as well as other features related to this collection. These features include calculating distance between planets, listing all planets in a nicely formatted manner, adding planets to the solar system, and checking if the given planet is present in the solar system instance by name. I feel that these are all relevant responsibilities to the SolarSystem class as there is no other major component to it that does not already have it's own class.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? main.rb is the only file that I created that needed any 'require's . I just placed these at the top of the main.rb file. The files required were the solarsystem and planet files. The pattern that emerged was that only the file executing the main CLI needed access to other files to properly function.

@snowistaken snowistaken changed the title Moved files over to correct repo Time - Emily Feb 24, 2020
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