Skip to content

Latest commit

 

History

History
 
 

4_PezDispenser_solo_challenge

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Week 6 Home

U2.W6: Create a PezDispenser Class from User Stories

SOLO CHALLENGE OPTION 1

Learning Competencies

  • Implement a basic Ruby class and identify when to use instance variables
  • Translate a user story into driver code and solutions
  • Translate driver test code into a class structure using object-oriented design

Summary

In this challenge, you will translate user stories into an Ruby object (using a class). If you aren't sure what a user story is, use the power of google to do some research. Also make sure to practice using your new assert knowledge!

Release 0: Review the User Stories:

  • As a pez user, I'd like to be able to "create" a new pez dispenser with a group of flavors that represent pez so it's easy to start with a full pez dispenser.
  • As a pez user, I'd like to be able to easily count the number of pez remaining in a dispenser so I can know how many are left.
  • As a pez user, I'd like to be able to take a pez from the dispenser so I can eat it.
  • As a pez user, I'd like to be able to add a pez to the dispenser so I can save a flavor for later.
  • As a pez user, I'd like to be able to see all the flavors inside the dispenser so I know the order of the flavors coming up.

Release 1: Review the Driver Code

These do not have expectations that would return true or false if called. Add assert statements (remember to define the assert method!) to make sure it's working properly.

Release 2: Pseudocode

We definitely know we have a PezDispenser class, but what are it's innards? What are PezDispenser's attribute(s) and method(s)? Take a moment to list out all the methods, and show the input and output. It's good to be clear when there isn't an input or output!

Release 3: Write your Initial Solution

Make sure your test code still works and satisfies the expected output.

Release 4: Refactor

Release 5: Reflect

Release 6: Push your solution to Github

Release 7: Review

Write feedback for at least two other solutions!