Emilce Sanchez - Solar System - Octos#34
Open
emilcecarlisa wants to merge 1 commit intoAda-C9:masterfrom
Open
Conversation
Solar SystemWhat We're Looking For
|
CheezItMan
reviewed
Feb 13, 2018
| # sudo gem install samsouder-titlecase --source=http://gems.github.com | ||
|
|
||
| require 'rubygems' | ||
| require 'titlecase' |
There was a problem hiding this comment.
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.
A couple of issues,
- You are making these with
attr_accessorwhich means a user could directly change the instance variables. Instead I would recommend making themattr_readerunless you really want to give a user the ability to reassign the instance variables. - Why are
planet_details,choose_planetplanet_listandadd_planethere? They're methods not instance variables.
| return updated_array | ||
| end | ||
|
|
||
| def add_planet |
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solar System
Congratulations! You're submitting your assignment.
Comprehension Questions
initializemethod in your class?SolarSystemused anArrayvs aHash.