Please follow these instructions to set up your computer for participating in the technical coaching program.
Learn TDD and Emergent Design by Pair Programming on katas.
- Your Thoughtworks MacBook (please don't use a client machine)
- Homebrew
- Visual Studio Code or IntelliJ IDEA
- Update Homebrew
brew update
- Install node and npm
brew install node npm
- Ensure you have installed Jest globally if you haven't already
npm install jest --global
or
yarn global add jest
- Install the remote collaboration plugin for your IDE:
- VS Code: install Live Share
- IntelliJ: ensure Code With Me is enabled
-
Fork repo. Click the Fork button at the top right. See forking a repository for further details.
-
Clone your forked repo
git clone git@github.com:<username>/technical-coaching.git
- Change directory
cd technical-coaching/<kata of choice>
- Open in your favorite IDE
code .
or
idea .
./test.sh
./test.sh --watch
- Try not to read ahead.
- Do one task at a time. The trick is to learn to work incrementally.
- Remember the Three Rules of TDD:
- You are not allowed to write any production code unless it is to make a failing unit test pass.
- You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.
- You are not allowed to write any more production code than is sufficient to pass the one failing unit test.
This kata introduces the red-green-refactor workflow of TDD via ping-pong pairing.
- Write a
Greeter
class withgreet
instance method. Initially, the method receives aname
as input and outputsHello <name>
. greet
trims the inputgreet
capitalizes the first letter of the namegreet
returnsGood morning <name>
when the time is 06:00-12:00greet
returnsGood evening <name>
when the time is 18:00-22:00greet
returnsGood night <name>
when the time is 22:00-06:00greet
logs on console every time it is run
Made popular by Roy Osherove.
- Try not to read ahead.
- Do one task at a time. The trick is to learn to work incrementally.
- Make sure you only test for correct inputs. there is no need to test for invalid inputs for this kata
This kata is one of the simplest and best ways to practice step-by-step fluent tdd, and provides an easy way to get proficient in a language.
Write a method add
under an object StringCalculator
that, given a delimited string, returns the sum of the numbers in the string.
- An empty string returns zero
'' => 0
- A single number returns the value
'1' => 1
'2' => 2
- Two numbers, comma delimited, returns the sum
'1,2' => 3
'10,20' => 30
- Two numbers, newline delimited, returns the sum
'1\n2' => 3
- Three numbers, delimited either way, returns the sum
'1\n2,3\n4' => 10
- Negative numbers throw an exception with the message
'-1,2,-3' => 'negatives not allowed: -1,-3'
- Numbers greater than 1000 are ignored
- A single char delimiter can be defined on the first line starting with
//
(e.g//#\n1#2
for a ‘#’ as the delimiter) - A multi char delimiter can be defined on the first line starting with
//
(e.g.//###\n1###2
for ‘###’ as the delimiter)
--> see the README in the url_shortener
directory