-
Notifications
You must be signed in to change notification settings - Fork 45
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
Emilce Sanchez - Solar System - Octos #34
base: master
Are you sure you want to change the base?
Conversation
Solar SystemWhat We're Looking For
|
# sudo gem install samsouder-titlecase --source=http://gems.github.com | ||
|
||
require 'rubygems' | ||
require 'titlecase' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're requiring gems, which is new. neat!
|
||
class SolarSystem | ||
|
||
attr_accessor :planet_details, :choose_planet, :planets, :planet_list, :add_planet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of issues,
- You are making these with
attr_accessor
which means a user could directly change the instance variables. Instead I would recommend making themattr_reader
unless you really want to give a user the ability to reassign the instance variables. - Why are
planet_details
,choose_planet
planet_list
andadd_planet
here? They're methods not instance variables.
return updated_array | ||
end | ||
|
||
def add_planet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is part of SolarSystem
and it's mixing concerns a bit. It's part of SolarSystem
and also dealing with the user and keyboard input and puts. This is a mix of roles. Generally a class should deal with one concept. In this case SolarSystem
should focus on being a collection of planets and operations you can do on a SolarSystem
. So Solar System does it's thing and methods in the main program can deal with the user.
BTW this is a very minor thing in this project
Solar System
Congratulations! You're submitting your assignment.
Comprehension Questions
initialize
method in your class?SolarSystem
used anArray
vs aHash
.