Skip to content

Branches - Angele#36

Open
geli-gel wants to merge 18 commits intoAda-C12:masterfrom
geli-gel:master
Open

Branches - Angele#36
geli-gel wants to merge 18 commits intoAda-C12:masterfrom
geli-gel:master

Conversation

@geli-gel
Copy link
Copy Markdown

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 for the creation of objects of the classes SolarSystem and Planet. For SolarSystem it requires that a star_name is provided, and sets that value to the instance variable @star_name, and for Planet it requires all details of the planet to initialize the new object.
Why do you imagine we made our instance variables readable but not writable? We made our instance variable readable but not writeable because we don't want them to get overwritten by accident.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? If each planet was stored as a Hash instead of an instance of a class we would have to make the summary method somewhere separate, and it wouldn't be able to be part of the planet inherently, and would also look a lot messier in code since the string interpolation would be accessing nested hashes.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? If SolarSystem used Hash instead of an Array to store the list of planets, I think it would make sense to store the planet names as the keys and their information as the values, but if the planets are instances of classes it makes more sense to put it into an array since the attributes can easily be found with enumerable methods, which also work on hashes but there wouldn't be as much confusion from nesting.
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 SolarSystem class has the responsibility of keeping track of planets in the system, and the Planet class has the responsibility of keeping track of planet information, so I think maybe the answer is yes, but now I'm wondering if all of the methods in main.rb were supposed to be in the class files...
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? I put require_relative for the planet and solar system class files at the top of main.rb, the other files did not need any require statements since they contained only the templates for classes - their initial state and available behaviors, that are called from main.rb.

@jmaddox19
Copy link
Copy Markdown

Solar System

What We're Looking For

Feature Feedback
Baseline
Whitespace (indentation, vertical space, etc) X
Variable names X
Git hygiene GREAT job making lots of incremental commits! That habit will really pay off at some point soon!
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! Very clean well-written code!

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