Skip to content

Conversation

@dev-elle-up
Copy link

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
When does the initialize method run? What does it do? The initialize method runs whenever a program runs .new on a class (ex: SomeClass.new). The initialize method then generates a new instance of that particular class.
Why do you imagine we made our instance variables readable but not writable? Once the instance was created, we didn't want them to be changed in the future.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? The methods that use the planet data would have to be stored separately.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? The syntax for accessing information about a particular planet would be different. Also, when the planets are listed, the order might change and so some additional code would be needed to ensure the list gets printed for the user in the correct order each time.
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 that "exactly one thing" is subject to interpretation. The Planet class is responsible for making new planets and printing a summary about any given planet. The SolarSystem class is responsible for everything related to solar systems (creating them, assigning a sun name, creating a list of planets in the solar system, and enabling the program to search for a particular planet). So the SolarSystem class does multiple things but they are all related to solar systems.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? Only the main file needed require statements. It seems whatever file is running the program - whatever file the user is interacting with - is the one that needs to access the other files.

@kaidamasaki
Copy link

Solar System

Good job! Your classes all look good.

It looks like you forgot "planet details" in your main method/prompt though. In the future consider making a second pass through the project description when you're done to make sure you didn't miss any little details.

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.

2 participants