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 - Shamira #41

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

Ports - Shamira #41

wants to merge 4 commits into from

Conversation

MiraMarshall
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 when a new instance of the class is created.
Why do you imagine we made our instance variables readable but not writable? Generally, a user should not be able to change the planet information.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? It wouldn't be much different. I would have to pull the key/value pairs to display information from the @planets array.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? I would have to pull the key/value pairs to display information instead of calling the @planets object. It would be more difficult to create behaviors for the planets.
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 the state of each planet and prints out the info in a summary. The Solar System class modifies the behavior of each individual planets. The Main class takes information from Planet.rb and solar_system.rb to run different methods from those files.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? The main.rb file needed 'require' to get information from both the planet.rb and solar-system.rb files since it used methods made in both files to run the program. I did not 'require' any other files.

@CheezItMan
Copy link

Solar System

What We're Looking For

Feature Feedback
Overall Not bad, you hit the learning goals of the project. See my inline notes on the new_planet method.

sol_system.new_planet
puts sol_system.list_planets
end
break

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This break is always going to make the loop exit.

# @planets.name specify that you're searching the name
end

def list_planets_one

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method seems a duplication of the above

end
end

def new_planet

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be better as a method which takes a Planet as an argument and adds it to the planets array. That way you're separating the user-input task from the task of storing and organizing the planets.

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