Skip to content

Latest commit

 

History

History
 
 

9_gps2.1

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Week 5 Home

U2.W5: The Bakery Challenge

This is a Guided Pairing Session challenge for Unit 2. Please do not look at the challenge until your guided pairing session.

Learning Competencies

  • Identify and explain what code is doing
  • Identify and rewrite repetitive code
  • Use if/else statements, string methods, while/until loops, Enumerable#each methods

Summary

Your future career will require you to deal with a lot of "legacy code," i.e. code that works as intended, but is difficult to modify. Sometimes you will be given the option to start over or modify the original code. Other times you will be forced to work with legacy code due to time or budget constraints. In this challenge, you have the option to completely trash the code and start over or work with the code that's here, but make sure that it works the same way. The driver code should still print "true" without being modified.

Release 0: Run the code

Whenever you get a set of code, you want to run it to make sure it works. Run the code in your terminal before making any changes.

Release 1: Identify the purpose

Based on the test code at the bottom, what is the code doing (in general)? Identify the inputs and outputs? What do the tests output and why?

Release 2: Read, Indent, and Comment

Read through the code indenting as you go. After each block, write a comment to explain what the code is doing.

Release 3: Refactor

When you get to code that is difficult to read, seems redundant, or stupidly executed, pause and refactor it. Make sure your changes don't break any of the tests! Refactor with future expandability in mind, you may decide to add some features later!

Release 4: Reflect

When the session is over, reflect on your learning.

Release 5: Submit Feedback for your Pair

Submit Feedback on Feedbackinator

Release 6: Submit your challenge!

Sync your changes (push your solution) to Github! Remember to include your pair's name!

Optimize Your Learning:

(In case you didn't get enough of the delicious horrible-code)

Expand the program for the customer based on their requests. Use the methodology you've been practicing! (Write Driver Test Code, Pseudocode, Write your initial solution, Refactor, Reflect)

Hi! I am a small bakery owner who has a ruby program that calculates the number of items I need to bake for a customer with a favorite food. I love the program as it is, but I want to add a couple of features:

  1. The owner wants to have options to include a mix of all items, rather than favorite foods.
  2. The owner wants to add the following items to the menu: pudding (feeds two people), bunt cake (feeds 4 people), and mega-cupcakes (feeds 3 people)

NOTE: Write your own tests based on your expansion. The original tests should still pass.