Skip to content

Fire - Madeline#53

Open
made-line wants to merge 3 commits intoAda-C14:masterfrom
made-line:master
Open

Fire - Madeline#53
made-line wants to merge 3 commits intoAda-C14:masterfrom
made-line:master

Conversation

@made-line
Copy link
Copy Markdown

@made-line made-line commented Sep 29, 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 runs in main.rb when you see <class_name.new>. It creates a new instance of a class.

| Why do you imagine we made our instance variables readable but not writable? |
We don't want the end user to change the instance variables.

| How would your program be different if each planet was stored as a Hash instead of an instance of a class? |
The syntax for iterating over a hash would be different. We could also pull data by the keys or values.

| How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? |
We'd call the planets by calling the hash key (:name).

| 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? |
Yes. The solar system class manages planets. The planet class only contains planet information.

| How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? |
In solar_system.rb, I used require_relative "planet". In main.rb, I used require_relative "planet" and require_relative "solar_system". planet.rb didn't use require_relative. The pattern is that whichever file is using data from another file will need the require_relative.

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