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

Ports - Faiza Husain #28

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

Ports - Faiza Husain #28

wants to merge 9 commits into from

Conversation

Faiza1987
Copy link

@Faiza1987 Faiza1987 commented Feb 27, 2019

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
When does the initialize method run? What does it do? The initialize is run when a new instance of the Planet class is created. It's purpose is to ensure that a planet is not created without the required attributes (name, color, mass, distance from sun, fact)
Why do you imagine we made our instance variables readable but not writable? We are only reading information from the classes. Also, we cannot change any information about the planets because all the attributes in our Planet class are facts.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? If our planets were stored in a hash in its own file, it would be harder to access that hash in other classes. Also, it would be harder to create a method like add_planet or create a new planet.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? Each planet that is stored in the hash will need a key with the planet object as the value of that key. The methods which we're using to access information in the hash would need to be more verbose.
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? The Planet class creates a blueprint for what each planet should have and print a summary of the planet(s). The Solar System class includes a Star and the planets orbiting that star. The main class contains the CLI and displays information from both the Planets and the SolarSystem classes. I believe my classes follow the SRP
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? The main.rb file requires both classes. I also required planets.rb in solar system because there is an instance of a planet class in the solar system.

@kaidamasaki
Copy link

Solar System

Good job! Your code is clear and well organized. You hit all the learning goals.

One minor thing is that it looks like you left some unused code in SolarSystem but that's a simple enough thing to clean up.

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