th-ko wrote:
Quote:
|
Leave the dumb easy stuff for last - within an iteration. Or one the the next iterations, right?
|
Nope. From the top:
- the Onsite Customer selects stories
- developers estimate them
- the Onsite Customer cuts one short stack
for this week
- developer do the high-estimate ones first
Before the developers run out of time (typically before one week), they get
around to low-estimate ones. These are still equal priority with the
high-estimate ones.
An iteration should end with as many stories completely done as possible.
90% of the stories 100% done is better than 100% of the stories 90% done.
So the team has no option and little incentive to boot the low-estimate
stories out of this iteration. By Thursday the team should recognize which
stories cannot be finished, and should boot _those_. Then they should take
care of all the low-estimate stories.
This is similar to how to do a math exam. Go thru once looking for anything
you can easily knock out. Then go back and do all the intermediate
questions. Then go back and apply soak time to the hard ones. Then go back
and re-check everything.
Actually, it's the opposite of how to do a math exam. A teacher would give
90% credit either way, whether you finished hard ones or easy ones. An
Onsite Customer will not. Do the hard ones first, boot out the hardest ones,
and spend the remaining time finishing up the easy ones.
Quote:
|
.. you would pick the simplest kind of triangle, simplify it, and repeat for the next more complex kind of triangle. Solve the smallest possible problem and then extend it. If it reaches a level that satisfy the QA then care for the next detail, correct?
|
"QA" means the Customer Team members who write acceptance tests. We are only
talking about development and unit tests from now on.
Solve the simplest problem of the current user story first. If the user
story says "invent a language", then write a test for 'print "hello world"'
first. Pass the test, then add integers, operators, and so on.
Quote:
|
Ok, that is exactly my problem. I can't identify _meaningful_ unit tests.
|
If you were going to write the first line of code, what would it be?
(You might also write this program in a sandbox, without TDD. Then take what
you learned and write it all again with TDD creating each line.)
Quote:
|
To be more precise: I might test for example whether the next neighboring point p of a point q is really the next point from a given set. But the meaning for the algorithm or even method might rather small.
|
Yes: You write a purely stupid test that _only_ checks that one point is the
neighbor. For example:
points = [[2,2,2], [3,6,1], [5,9,8]]
nearest = getIndexOfNearestPoint([1,1,1], points)
assert_equal 0, nearest
That's all: Just a test you could pass blindfolded. You could even hard-code
'return 0' inside the function.
Quote:
|
Are this fractions of unit tests ever combined to bigger unit tests? If yes, how?
|
By using the unit tests to force your lies in the code to go away. Here's
the next test:
points = [[3,6,1], [2,2,2], [5,9,8]]
nearest = getIndexOfNearestPoint([1,1,1], points)
assert_equal 1, nearest
Careful inspection of that source should reveal simply cloned and modified
the last test case to create this one. That is a perfectly valid technique.
But now my new test forces me to change the source of
getIndexOfNearestPoint(). It must now actually have some logic. So I replace
the contents with the _simplest_ logic that
Keep going like this, and the contents of the function will grow.
(And read either of the books called /Test Driven Development/.)
Quote:
|
You describe an "acceptance test". That's a high-level test which generally demonstrates the code matches its requirements. If this is not automated its still ok for XP?
|
Nope. For XP, the outer cycle around TDD, your team should respect such
tests, and should automate any kind of test they can possibly automate, if
they all agree to its quality and relevance. No code should be untestable.
Quote:
That's because you started top-down. Start hard algorithms bottom-up. Ok. I get a lot of tiny parts. And in the end of this process a this tiny test are clustered to bigger test?
Quote:
|
DbC is a competing theory and a complementing system.
|
Isn't the basic idea of both to test the code for things that might go wrong?
|
TDD is also a design technique. DbC can't start simple and grow. (It can,
and when it does it's just TDD, not really DbC!)
Quote:
However, you also can't write a contract first and then write code to pass the contract. (You trivially can. But TDD is also about designing by writing more failing tests and passing them, and you can generally only fail a contract once! I don't really understand what you mean here. If a unit test fails I rewrite the code to make it pass. If a contract fails I do the same, start the software and test whether the contract fails again. I guess you can even automate it to a certain degree.
|
You can't run sample data thru the contract and get results. So you can't
use the contract to force the designs to grow.
--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!