Skip to content

Conversation

@goblineer
Copy link

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
When does the initialize method run? What does it do? Initialize runs when a Class.new creates an instance. It sets up the state of the class object before any methods affect it.
Why do you imagine we made our instance variables readable but not writable? Planets are extremely old. If they start changing size and mass, we have a lot more to worry about than our code. In all seriousness, though, the instance variables were set as readable as the purpose of the program is to display information and sometimes add a whole new planet. There is no functionality that a writer would provide.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? It would have been SO DIFFERENT. For one, I think I would have gotten it to work with less frustration, but the classes and methods are much more efficient (since there's a bunch of planets and their states and behaviors are all the same, though the values are all different). If there were hashes instead, there would have been an enormous amount of repetition in the code itself because there was no .clv or anything to transform the data from. We would have just been hard-coding a zillion repeated keys and their values.
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets?
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?
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern?

@CheezItMan
Copy link

Solar System

What We're Looking For

Feature Feedback
Overall You didn't answer all the comprehension questions. You did hit all the learning goals for the project. Nice work.

@@ -0,0 +1,25 @@
require 'faker'
def autofactoid(planet_name)

Choose a reason for hiding this comment

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

Later on, I would suggest making this a private helper method, which is a concept we'll get to later.


def find_planet_by_name(query)
matches = @planets.select do |planet|
planet.name == query.capitalize

Choose a reason for hiding this comment

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

I suggest also capitalizing planet.name.

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