Skip to content

Yolotzin Dunbar - Solar-System#39

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

Yolotzin Dunbar - Solar-System#39
ydunbar wants to merge 5 commits intoAda-C13:masterfrom
ydunbar:master

Conversation

@ydunbar
Copy link

@ydunbar ydunbar 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? The initialize method runs when each object is instantiated. It creates the object with it's class attributes.
Why do you imagine we made our instance variables readable but not writable? I'm not sure. Maybe because main.rb only needs to read in these variables once they are assigned? I still need a deeper understanding of the affordances of readable versus writable instance variables.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? There may be more room for error or inconsistencies between planets, ie if one planet had less data than the others. The class ensures that each planet is similar in defined ways.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? There would be additional loops required to read the hash, and that would make the program less efficient.
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 my classes follow SRP in the sense that a planet or a solar system is a single idea or "thing". They only contain methods that pertain to that "thing" and not to another "thing".
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? main.rb required the files that contained the class definitions, in order to access them. main.rb needed to read from these files, but the class files did not need to read anything from main.rb.

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