Skip to content

X529970/sandc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is the homework assignment as developed and completed by Storm Holloway and Charissa Smith.

We chose to model a restaurant. The two specific elements we focussed on are the Waiter and the Customer. The Customer also has an Order.

OK I think we are done with this little exercise. It is unfortunately not a stellar example of much however it is time to move on to something else (law of diminishing returns and all that...). In addition to learning how to install and configure a bunch of junk and how to communicate with github and work collaboratively, here are some of our lessons learned:

- Taking a BDD or TDD approach does not insure good design. For example, a bunch of things that work with an 'order' in this system should deal with an array not just a scalar. Our communications between waiter and customer are not as clean as they could be. Etc. Lot's of stuff could be better.

- Naming of things is important (e.g., class Order, instance called order, order.items -- was originally order.order) If you realize you screwed up the naming of something, you should fix it (refactor it) pretty quickly. Regaining the time you will lose making stupid mistakes due to the bad choice should more than make up for the cost of refactoring it early. We still haven't done that.

- if you have tests and they test your PORBs in another file, it doesn't mean your app is going to work. You have to test that too. Or at least run it. Especially if you do a lot of refactoring in the process of making tests. (ours (restuarant_app.rb) actually did work, but that was lucky and it was an afterthought to test it)

- Don't forget to change anything that you want to add to your README before you do a commit. I have a bunch of "paired" commits due to that error

- "cucumber --format usage"    helps you identify unused steps in your steps file

Some other things to note:
To get minitest to be available to the step definitions we had to:
- create a support directory under features
- add an env.rb file to the support directory with these lines
	require 'minitest/autorun'
	World(MiniTest::Assertions)
	
To have cucumber find the .rb files in lib, we had to:
- create a loader.rb file in lib with these lines:
	ROOT= File.expand_path './'
	require File.join ROOT, 'lib', 'xxxx.rb', xxxx is the .rb file to require, can later make this all .rb files in lib except loader.rb
- add this line to env.rb
	require File.join "./" ,"lib" ,"loader.rb"
	
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------	
Here is the gist of what we have modelled (result of running lib/restaurant_app.rb). If you try to run it yourself you will likely get a different
result. Be careful because the 'require' assumes you are in the lib/ directory when you run it. I still haven't figured out the best way to make these 
references...


ruby-1.9.2-p180 :203 > load './restaurant_app.rb'
Welcome to SandC's Fine New Restaurant.
We have an extensive menu, although we only serve foods that start with the letter P.

pizza             $10.49
pasta             $ 8.86
porkjowl          $13.00
persimmons        $ 6.00
potatosalad       $ 7.50
plankton          $ 5.00
parsley           $ 0.50


Currently we only have one waiter whose name is Bob. We tried to hire someone named Paul
to fit with our P-themed restaurant, but we were concerned that Bob may bring suit as
he was clearly the better candidate. 

Bob's only weakness is that he is a bit volitile -- in fact perhaps a bit manic depressive.
When he greets a customer he says something different depending on his current mood -- which 
changes on a dime. For example, here is what he said to the last 10 customers:

        Hello, My name is Bob. How can I serve you today?
        Sup? What can I get for your supper?
        Wadda you want?
        Sup? What can I get for your supper?
        Wadda you want?
        Chill. I will be back soon to take your order.
        Chill. I will be back soon to take your order.
        Chill. I will be back soon to take your order.
        Wadda you want?
        Hello, My name is Bob. How can I serve you today?
        Chill. I will be back soon to take your order.

But Bob is not the only moody one. Each customer when they enter the restaurant comes in
bearing the goodness or badness of their day. Today we have 4 customers and here are their
moods:
          happy
          very happy
          happy
          indifferent

Hopefully their experience in our restaurant will positively alter their mood, cause them to
leave a good tip and to come back later with all of their friends. Unfortunatly with Bob's
volatility, we cant be so confident of that result. Lets take a look at our first customer's
experience:

  He comes in feeling happy
  Bob greets him with: Wadda you want?
  After this his mood is indifferent.  Our customer orders a few things from the menu.
  He is hoping to enjoy  pizza, plankton, potatosalad.
  After enjoying his fine meal, he gets the check and calculates a tip.
  His meal costs $22.99 and he decides to leave a tip of 10%
  He leaves the restaurant with the following thought- I'm never coming here again

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages