Skip to content

Branches - Diana #29

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

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

Branches - Diana #29

wants to merge 3 commits into from

Conversation

dhan0406
Copy link

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
When does the initialize method run? What does it do? Initialize method runs when you call .new class with a parameter in the main.rb file.
Why do you imagine we made our instance variables readable but not writable? We want to be able to read :star_name and :planets but not be able to change it or replace it.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? We could create a program in one file and organize the data by creating keys: name, color, mass_kg, distance_from_sun_km, fun_fact. We would iterate through the hash to access its corresponding values.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? If the order of the name of the planets did not matter, we could utilize a hash to store other associated data of each planet.
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? The Planet class organizes all information pertaining to each planet. The SolarSystem class takes and tracks of the name of the planet.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? The main.rb file required class files to run the code. The class files each had its responsibility with unique instance variables.

@jmaddox19
Copy link

Solar System

What We're Looking For

Feature Feedback
Baseline
Whitespace (indentation, vertical space, etc) X
Variable names X
Git hygiene You'll probably want to start committing is smaller commits. (ie. When you finish making the planet class, when you make the planet_details method, etc.) It's a hard habit to get into but as the projects get bigger, things will get harder to keep track of and you'll break something and you'll want a recent working version to go back to.
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 Not a big deal, but I noticed you used puts rather than returning the string in the list_planets method. We're starting to move away from using "puts" anywhere other than "driver code".
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!

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