Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kayla's Mario Themed Solar System #32

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open

Conversation

Kaylaj89
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 called on new objects once they've been created. The initialize method allows programmers to set default values for each instance variable.
Why do you imagine we made our instance variables readable but not writable? Lots of bad data can be passed through via a colleague or other user if writer privileges were given. Reader privileges make sure the code stays as it should.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? I think my program would look more like my ride share program. There would be a big array called 'Solar System' and within the array there are several instances of a planet that are stored in a hashes. I feel like using classes for planets helps lessen data entry mistakes and just looks cleaner overall.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? Solar_System = {1: earth, 2:pluto, 3:...}. It's hard for me to think of what would be different--obviously calculations for printing would be different. This is an interesting question and i'm eager to hear from my peers on what they think.
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? Planet class = sets initial values for all planets, outputs summary of each class once it has been initialized. Solar_System class = manages the methods for accessing the entire solar system eco system.
How did you organize your require statements? Which files needed `requires, and which did not? What is the pattern? Admittedly, I was not very strategic with my 'require' statements. The Planet class required the Solar System class and vice versa and the main.rb required both the planet class and solar system. I think I could have achieved everything fine if I had just kept the 'require' elements on the main page.

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