Skip to content

Time - Lola#42

Open
ubeninja77 wants to merge 9 commits intoAda-C13:masterfrom
ubeninja77:master
Open

Time - Lola#42
ubeninja77 wants to merge 9 commits intoAda-C13:masterfrom
ubeninja77:master

Conversation

@ubeninja77
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? initialize method runs when a new instance of that class is being made; creating a new instance of that class
Why do you imagine we made our instance variables readable but not writable? we don't want the user to overwrite the data stored in the instance variables (or hard coded).
How would your program be different if each planet was stored as a Hash instead of an instance of a class? I would not need to use classes because the planets would be stored in the hash.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? I would need to rewrite how to access/search used. If the planets were stored in a hash, the class would not be needed.
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, examples are the planet and solar system class. In Planet, the class stores specific information regarding each planet. In solar system, the class stores information about the collection of planets.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? I used the require_relative in the driver code (main.rb). These are needed to interact with planet.rb and solar_system.rb to share data between the three files.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

Just looking back a bit based on grocery store. You didn't seem to run this code with ruby main.rb, maybe check in at some point to make sure you know how to run/debug your applications.

class Planet
attr_reader :name, :color, :mass_kg, :distance_from_sun_km, :fun_fact

def initalize(name, color, mass_kg, distance_from_sun_km, fun_fact)

Choose a reason for hiding this comment

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

Initialize is misspelled

Suggested change
def initalize(name, color, mass_kg, distance_from_sun_km, fun_fact)
def initialize(name, color, mass_kg, distance_from_sun_km, fun_fact)

Comment on lines +21 to +22

until directions != "exit"

Choose a reason for hiding this comment

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

You should also initialize directions, i.e. give it a start value.

Suggested change
until directions != "exit"
directions = ""
until directions != "exit"

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