Skip to content

Conversation

@easternwashingaden
Copy link

Assignment Submission: Solar System

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

Question Answer
When does the initialize method run? What does it do? The 'initialize method runs when we create new instance. It creates new instance with needed attributes.
Why do you imagine we made our instance variables readable but not writable? because for this project, we just need to read the attributes of the instances and we don't need to write/overwrite the attributes that have been assigned.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? Then @planet array will be an array of hashes instead of array of objects/instances. Thus, the way we retrieve/print data will be different.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? Then the @planet will be a hash of all planet instances. then the ways we retrieve data will be different.
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 program has two classes, Planet and SolarSytem. class Planet only represent planet instances while SolarSystem class is responsible for only solar system instances.Though, each class has a few methods that each method does only one functionality.

|How did you organize your require statements? Which files needed requires, and which did not? What is the pattern?| planet.rb and solar_system.rb do not need the require statements. The main.rb is driver code file where it requires 'require' statements. Those are require_relative 'planet' and require_relative 'solar_system'

Additional notes: I tried to fix the tab size to 2, but it didn't work in my settings

For printing 'planet details', the user can only type the planet name that is in the list; otherwise, it would give the user an error. I tried so hard to fix it but I couldn't fix it :(

Thank you

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.

1 participant