Skip to content

Solar System #44

Open
KayKay-git wants to merge 3 commits intoAda-C14:masterfrom
KayKay-git:master
Open

Solar System #44
KayKay-git wants to merge 3 commits intoAda-C14:masterfrom
KayKay-git:master

Conversation

@KayKay-git
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? It runs every time you create a new instance of the class. The initialize method will allow us to create attributes for each instance of the class. It is called automatically whenever .new is called. It basically allows us to set the initial values for an object.
Why do you imagine we made our instance variables readable but not writable? Because we don't want to change our planet info. We only want to read it back.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? It may make it less time efficient since I would need to iterate through the hash to get planet information. With a class, I can just call each method to retrieve that info.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? With a hash I would need to come up with a key to store the planet list. Extra step.
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? Yes, the planet class stores information of each planet. The solar system class will hold and update planet data.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? Files that contain classes are needed require statements so that it can access those classes and their respective methods. In this assignment, the main.rb file needed those statements.

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