Skip to content

Corinna - Time#38

Open
corinna-fab wants to merge 1 commit intoAda-C13:masterfrom
corinna-fab:master
Open

Corinna - Time#38
corinna-fab wants to merge 1 commit intoAda-C13:masterfrom
corinna-fab:master

Conversation

@corinna-fab
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? Initialize defines initial values for an object at the start of its creation. Initialize lives within the object's Class.
Why do you imagine we made our instance variables readable but not writable? We make the variables readable and not writable to better control what the user can and cannot change, which is also why we define a way for them to modify the planets list later in the program, but in a controlled way.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? The results would be the same but the code would require more complex iterations and wouldn't allow us to control where/when things can be added/changed.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? Mostly just more complex iterations, I think, but may be easier to call by key?
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 Planet Class follows SRP by defining the information required for a planet, and whether it is writable or readable. However, the Solar System Class defines the information required for a solar system, but also uses helper methods that loop in the Planet class, which might mean it deviates from SRP, given that that functionality could possibly be taken out of the class and instead be connected in another way.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? The file with actionable code requires us to 'require' the Classes it is using (in this case Planet and Solar System). In general, most of my 'require' statements live at the top of my document, unless I am using something like Pry, which I require just above where I am using it to help me remember to take it out later.

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