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

Earth - Jasmine #29

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

Earth - Jasmine #29

wants to merge 6 commits into from

Conversation

jasyl
Copy link

@jasyl jasyl 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? It allows for instance variables to be assigned right when you create an instance of an object.
Why do you imagine we made our instance variables readable but not writable? Didn't want to change the object once it was initiated. Doesn't really make sense to go back in and update attributes of a planet from the main.rb side.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? I think it would approximate what we did with classes for Solar System pretty closely. Main differences that come to mind are that the hashes would be editable (unlike the class). The methods and the variables will all be visible and accessible. You wouldn't be able to have methods that apply to certain objects, you'd have to define them specifically to accept certain parameters and be aware of that.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? I'm a little confused by this question. I think it's fine but I'm not sure what the key would be. It could be {planet_1: } It feels like it adds a level of unnecessary complication.
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? No, they're responsible for a lot of stuff. the SolarSystem class adds planets to an array, finds the distance between two planets, find a planet by name if it's available. Definitely does not do just a one thing.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? I only used require_relative and that was on the class files. I believe this is because they're local files. However, if I were to install a gem or something that wasn't available locally, I'd use require

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