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

Roshni - Solar System #41

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

Conversation

roshni-patel
Copy link

@roshni-patel roshni-patel commented Sep 23, 2020

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 a new instance of a class. It sets up the object based on the arguments passed in for the given parameters.
Why do you imagine we made our instance variables readable but not writable? We don't want the instance variables to be edited. For example, we wouldn't want a user to be able to change the information about a planet, especially if that information is incorrect and could be detrimental to other users' learning about the planets.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? We would have to iterate through the hash in order to find the requested information, similar to the Rideshare Project where we used nested data structures to build our program.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? We would have to iterate through the hash and use its keys to access the relevant information.
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? I'm not sure that my classes follow SRP. Solar System, for example, has the responsibility of creating solar systems (using the star_name) while also tracking planets within solar systems (how many planets there are, what their information is, what the distance between planets is, etc.). Planet may be a better contender for following the Single Responsibility Principle (SRP) as it focuses on tracking information about a planet.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? My testing files used 'require relative' to access the files for the Solar System and Planet classes (e.g. solar system test file required solar_system.rb). The main file also needed 'require relative' to access both the Solar System and Planet classes. The Solar System class needed access to the Planet class so it used 'require relative' as well.

@roshni-patel
Copy link
Author

Please disregard the main.rb, planet.rb, and solar_system.rb files. The files for the most updated version of the project are in the lib and test folders. 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