Skip to content

Time - Haben#20

Open
HabenFoto wants to merge 5 commits intoAda-C13:masterfrom
HabenFoto:master
Open

Time - Haben#20
HabenFoto wants to merge 5 commits intoAda-C13:masterfrom
HabenFoto:master

Conversation

@HabenFoto
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? When it is called from .new of the class. It helps create an instance of the class and to store attributes.
Why do you imagine we made our instance variables readable but not writable? Because we don't want to change the value of the attributes once we create them.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? Because if we use Hash, then we have to loop/iterate through to get information whereas in an instance of a class we can just call upon a method to get specific information.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? Using Hash, the name of the planet will be key and the planet instance as value. While in an Array, the planets are stored directly into the array.
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? The class Planet stores information about the planet only, so it follows SRP. The SolarSystem class stores instances of planets and has methods to access them, this also follows SRP.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? The require statements are in the main or the driver code since it depends on the planet and solar_system files to run.

@HabenFoto HabenFoto closed this Feb 20, 2020
@HabenFoto HabenFoto reopened this Feb 20, 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