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

Branches - Linnea #40

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

Branches - Linnea #40

wants to merge 6 commits into from

Conversation

llinneaa
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 that class is instantiated, like Class.new. The method defines the parameters the program accepts and stores in each instance of the class.
Why do you imagine we made our instance variables readable but not writable? They were only made readable so we could not overwrite the data stored in the instance variables.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? Overall, I would say I would have less control over my program if each planet were stored in a hash instead of an instance of a class. The program would also be much less clear and easy to read/understand, especially if someone else besides me were to read it.
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 access the list of planets differently in each method where I currently use the array.
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, each class stores information about a specific thing. The Planet class stores information specific to each planet, and the SolarSystem class contains a collection of planets - it stores information and performs operations related to planets within the solar system, such as listing all of the planet names.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? I only put my require_relative statements in the driver code (main.rb) and included the statement for each class I was using for the program. The driver code needs the requires statements because that is where the classes 'interact' with the program and each other.

@jmaddox19
Copy link

Solar System

What We're Looking For

Feature Feedback
Baseline
Whitespace (indentation, vertical space, etc) X
Variable names X
Git hygiene X
Planet
initialize method stores parameters as instance variables with appropriate reader methods X
summary method returns a string X
SolarSystem
initialize creates an empty list of planets X
add_planet takes an instance of Planet and adds it to the list X
list_planets returns a string X
find_planet_by_name returns the correct instance of Planet X
CLI
Can list planets and quit X
Can show planet details X
Can add a planet X
Complex functionality is broken out into separate methods X
Overall Great job!

@fun_fact = fun_fact
end

def massChecker(mass_kg)

Choose a reason for hiding this comment

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

Very cool to decide to put the checking into separate methods!

Choose a reason for hiding this comment

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

Makes it so much easier to read!

end
end

def distanceChecker(distance_from_sun_km)

Choose a reason for hiding this comment

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

Is there a reason why you aren't calling this one in the constructor like you call massChecker?

Choose a reason for hiding this comment

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

To clarify, a negative distance can be entered because this isn't called.

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