# Let's Build a Tamagotchi! ## A Live TDD Walkthrough
##James York `@kroysemaj` - *Instructor and Software Developer* - **Vry Srs Bsns, LLC.** - *Android / JavaScript* - **Detroit Labs** - *Organizer* - **Detroit Craftsman Guild** - *Instructor* - **Grand Circus Front-end Bootcamp**
## What is TDD? An attempt at a better way, by automating tests.
## Normal Software Development
##Why We TDD - Immediate feedback - Confidence to refactor - Executeable documentation - Design insight
## Red Green Refactor ![](images/TDD.jpg)
## Our Kata ![Tamagotchi](images/tamagotchi.jpg)
## What is a Tamagotchi A Tamagotchi is a small, handheld digital pet that you can feed, play with, put to bed and clean up after. Look after it well by feeding it the right kinds of foods, showering it with attention and cleaning up after it when required, and your Tamagotchi will grow up to be a smart, well-respected member of society. Ignore its needs and its mood will sour until it eventually dies.
## Our Stories - Tamagotchi has basic stats - Feeding Tamagotchi - Making Tamagothci poo - Tamagotchi's needs change over time - Tamagotchi can be Hangry - Tamagotchi can be Dead
## Tamagotchi has Basic Stats As a Tamagotchi owner I want my Tamagotchi to have basic stats So that I can know its current state --- GIVEN I have a Tamagotchi WHEN I inspect its stats THEN it has a default Hunger stat of 50 AND it has a default Fullness stat 50
## Feeding Tamagotchi As a Tamagotchi owner I want to feed my Tamagotchi So that I can satiate its hunger --- GIVEN I have a Tamagotchi WHEN I feed it THEN its hunger is decreased by 10 AND its fullness is increased by 10
## Making Tamagotchi 💩 As a Tamagotchi owner I want to make my Tamagotchi poop So that it is more comfortable --- GIVEN I have a Tamagotchi WHEN I make it poop THEN its fullness is decreased by 10
## Changing Tamagotchi Needs Over Time As a Tamagotchi owner I want my Tamagotchi's needs to change over time So that I have to look after it carefully --- GIVEN I have a Tamagotchi WHEN one minute passes THEN its hunger is increased by 10
## Tamagotchi Can Be 😿 As a Tamagotchi owner I want to know when my Tamagotchi is hangry So that I may give it a sandwich --- GIVEN I have a Tamagotchi WHEN its hunger is above 70 THEN its mood will be 😿
## Tamagotchi Can Be 💀 As a Tamagotchi owner I want to know when my Tamagotchi is dead So that I may hide the body --- GIVEN I have a Tamagotchi WHEN its hunger is 100 THEN its mood will be 💀
# DONE ![](images/done.gif)
## Dedicated Mocking Frameworks - SinonJS - TestDoubleJS What other features could we add that might benefit from mocking?
# Question / Comments?
#Thank you! ##James York @kroysemaj `Vry Srs Bsns, LLC.`