SOLO CHALLENGE OPTION 1
- 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
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!
- 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.
- Review the Driver Code (These aren't expectations) Add assert statements (remember to define the
assert
method!) to make sure it's working properly. - 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 asPseudocode, and show the input and output. It's good to be clear when there isn't an input or output!
- Translate your pseudocode into your Initial Solution Make sure your test code still works and satisfies the expected output.
- Refactor your initial solution.
- Reflect
- Sync your changes (push your solution) to Github
- Review