Skip to content

Instantly share code, notes, and snippets.

@msmith7904
Created October 22, 2014 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msmith7904/b845f676beb4811eedc1 to your computer and use it in GitHub Desktop.
Save msmith7904/b845f676beb4811eedc1 to your computer and use it in GitHub Desktop.
What were some of the issues with your first iteration of HMH Rail?
- It took way longer than it should have, considering its length. I got completely lost somewhere between steps 3 and 4.
Is there a lot of repeated code?
- Yes, for each if/eslif/else I repeated the same three lines of code. I also repeated the “You selected the __ train” string three times, which could possibly be replaced with a method that contains something along the lines of ‘puts “You selected the #{ } train.”’ I also repeated the string stating the stations options twice.
How flexible is the code?
- The code was not flexible at all. There was no way to add extra train lines and corresponding stations.
Where do you see room for improvement?
- All over the place to be honest.
What are the nouns for this problem domain? What real-world objects are we trying to represent through our code?
- Train lines, train stations.
What is the purpose of collections in programming?
- Flexibility, reduced repetition.
How can we use collections to represent our data in this problem domain?
- Storing the the train lines and stations in a hash would enable the addition of new elements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment