Skip to content

Time - Jocelyn#34

Open
wangjoc wants to merge 7 commits intoAda-C13:masterfrom
wangjoc:master
Open

Time - Jocelyn#34
wangjoc wants to merge 7 commits intoAda-C13:masterfrom
wangjoc:master

Conversation

@wangjoc
Copy link

@wangjoc wangjoc commented Feb 20, 2020

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? Creates the constructor to store and assign attributes for the class. It runs whenever a new version of the class is instantiated.
Why do you imagine we made our instance variables readable but not writable? We don't want people to go in and change different attributes of our planets since it should be a one-time data entry (as opposed to something that may fluctuate often like prices).
How would your program be different if each planet was stored as a Hash instead of an instance of a class? The information would be harder to extract and would be harder to keep track of and organize.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? I think it would be fairly similar, but would need to make adjustments to the code to account for the different syntax required to extract info from a hash. Since all the information related to the planet is all in the planet object itself, it seems unnecessary to have it as a hash.
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 it did. Each one was responsible for either keep track of planet, or solar system. The different methods that it had was to find planets by name or to find the distance between the two.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? I put all my require statements at the top of the file to keep easy track of them. Main.rb used all require_relative on the solar system and planet classes. I also required pry to help with debugging.

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