Skip to content

Branches - Clara#49

Open
CEsGutierrez wants to merge 5 commits intoAda-C12:masterfrom
CEsGutierrez:master
Open

Branches - Clara#49
CEsGutierrez wants to merge 5 commits intoAda-C12:masterfrom
CEsGutierrez:master

Conversation

@CEsGutierrez
Copy link

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
When does the initialize method run? What does it do? It is the constructor. It runs at the start of a class creation. It holds the instance variable master list that will be accessible throughout the methods created for that class.
Why do you imagine we made our instance variables readable but not writable? In thinking about the real world representation of the problem, maybe so that a person can’t just edit the properties of a celestial body.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? I imagine you’d need a lot more enumerable methods to be able to access the specific properties of each planet, though those would be stored in values and the keys would take the place of the instance variables. In addition, populating the class might be less readable.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? Adding planets to the collection would be different as the planet’s information could not be pushed in whole the way it is currently. Because at the moment, two instances of planet can have the same name, the keys may have to be some other uniquely-assigned number, the rest of the information could either go in as a value array or it could be separated into nested hashes within it to make the information easier to find. The structure would have to be more complicated.
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? My classes follow SRP. Solar_systems is in charge of the outer collection of planets when they have to be addressed as a whole. It can hold the information of all the planets in the solar system, find individual planets, and make lists of the planets. access and move information to other files but it does not interact with the user.

Planet is in charge of the individual planet’s class. It does not communicate with the user directly.

However, I find the main.rb file is very cluttered and within it the methods are not single-purpose as I would like, rather sweeping across the problem in a clumsy fashion.

| How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? | All the require statements are listed in the Main file, which required planet.rb and solar_system.rb

@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 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 Good job!

Your planet and solar system code is really clean. I agree with you that the main code is a little hard to follow, but I'm sure that would've been fixed with more time. This assignment had a real quick turnaround. And also it works well and does everything! Good job!

end
eval = nil
when "planet details"
puts solar_system_1.planet_details

Choose a reason for hiding this comment

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

This is really stirring my curiosity. planet_details is not a method defined on the solar_system class so I'm not sure how this is working.

def planet_details
print "Enter the name of the planet you want to search for: "
planet_search_term = gets.chomp.upcase
return_statement = find_planet_by_name(planet_search_term)

Choose a reason for hiding this comment

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

This is really stirring my curiosity. find_planet_by_name is a method defined on the solar_system class so I'm not sure how this is working without calling it on an instance of solar_system.

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