February 15, 2016
♡1♡♡♡1♡♡♡11♡1111♡11♡111♡♡♡1♡♡111♡111♡1♡♡♡♡1♡♡♡♡♡♡11♡♡♡1♡♡11♡♡1♡1♡♡1♡♡♡♡♡♡11♡11♡♡♡11♡♡♡♡1♡1111♡1♡♡1111♡♡1♡♡1♡11♡♡♡♡1♡♡♡♡♡♡111♡1♡♡♡11♡♡1♡1♡111♡♡11♡111♡1♡♡♡♡1♡♡♡♡♡♡1111♡♡1♡11♡1111♡111♡1♡1♡111♡♡1♡♡♡1♡♡♡♡♡♡11♡♡♡11♡11♡1111♡11♡♡1♡♡♡11♡♡1♡1♡♡1♡♡♡♡1
Back in the 1980s Ford Motor Co. had a marketing slogan: “Quality Is Job Done.”
... all American cars of 1980s and 90s vintage were junk
Japanese auto makers soon took center stage in car quality and thus sales
finish a task, which you consider is DONE
merge code into dev branch, send build to QA
they come back with a problem
you rejoice: "that an easy fix, just a null check and it's DONE"
Then quality tends to increase and costs fall over time.
he taught Japan’s top management how to improve design and product quality
you might have heard the phrase, "in this company we do things this way"! That's the way of the people, which becomes the way of the company
Could you say "assuring code quality is deeply rooted in my everyday process"?
Traditional cost of change curve
Augmented traditional cost of change curve, IBM
Kent Beck's cost of change curve, with the TDD approach
The social duty of a developer is to build quality products, therefore test your code and make everybody's life better
But he made a bit of a mess ...
... by not working incrementally
... by knowing about a structure which helps to "do right thing" / "build the code right"
Write a failing test
Watch the test fail
Write just enough code to make it pass
Watch the test pass
Fix the design (code and test)
Ensure that all tests still pass
Minute-by-minute cycles:
Per-task cycles:
... I don't like testing old code
... feels like there's not much value in it, now that the code is already built and working
TDD give you quality for "free", while helping you keep focused on what's truly important ... writing code :)
It might feel slower in the beginning, but once you get used to the process, it's proven to reduce costs
The following is a TDD Kata- an exercise in coding, refactoring and test-first, that you should apply daily for at least 15 minutes
1. Create a simple String calculator with a method
int Add(string numbers) :
2. Allow the add method to handle an unknown amount of numbers
3. Allow the add method to handle new lines between numbers (instead of commas):
4. Support different delimiters
5. Calling add with a negative number will throw an exception “negatives not allowed” - and the negative that was passed. If there are multiple negatives, show all of them in the exception message
6. Numbers bigger than 1000 should be ignored, so adding 2 + 1001 = 2
7. Delimiters can be of any length with the following format: “//[delimiter]\n” for example: “//[***]\n1***2***3” should return 6
8. Allow multiple delimiters like this: “//[delim1][delim2]\n” for example “//[*][%]\n1*2%3” should return 6.
9. Make sure you can also handle multiple delimiters with length longer than one char
... what's QA gonna do?
Keep in mind that TDD is more of a design process than a test process
February 10, 2016