Why Unit Testing sucks

P

Phrogz

A woman says to her Ruby programmer friend:

"As I was going to St. Ives,
I met a man with seven wives.
Each wife had seven sacks,
each sack had seven cats,
each cat had seven kits.
Kits, cats, sacks, wives:
how many were going to St. Ives?"

The programmer says:
"Hrm.
irb> (1..(%w|kits cats sacks wives|).length).inject(0){ |s,n| s +
7**n }
=> 2800

Er, wait, should the man with the wives be included in the count?
Maybe 2795."

"What?" says the woman. "No, the answer is one...you can only be sure
that the person telling the story was going to St. Ives. The man and
his wifes-with-cats posse might not have been going there."

The programmer chuckles.

....

At the next local Ruby users group meeting, the programmer decides to
tell the joke. He announces to the group:

"I have a joke. Er, wait, let me make sure I get this right...

require 'test/unit'

class Foo < Test::Unit::TestCase
def test_answer
answer = tell_joke
assert_equal( 1, answer )
end
end

Uhm...wait. Let me start over.
"

Everyone just sort of looks at him with pity.

Unit testing gives away the punchline!

:)
 
P

Phrogz

irb> (1..(%w|kits cats sacks wives|).length).inject(0){ |s,n| s +
7**n }
=> 2800

Er, wait, should the man with the wives be included in the count?
Maybe 2795."

Er...That 2795 should have read 2801. Oops.
 
E

Eric Hodel

A woman says to her Ruby programmer friend:

[...]

Unit testing gives away the punchline!

:)

I believe there are two lessons in your story:

You shouldn't write any code without knowing what you're doing.

You shouldn't write any code without knowing when you'll be done.
 
S

Stephan Kämper

Eric said:
A woman says to her Ruby programmer friend:

[...]

Unit testing gives away the punchline!

:)

I believe there are two lessons in your story:

You shouldn't write any code without knowing what you're doing.

You shouldn't write any code without knowing when you'll be done.

Corollary 1:

Although some code is a joke - some times even a WTF (also see
thedailywtf.com) - not all jokes can be used as code.

:)

Stephan
 
R

Robert Dober

Eric said:
A woman says to her Ruby programmer friend:

[...]

Unit testing gives away the punchline!

:)

I believe there are two lessons in your story:

You shouldn't write any code without knowing what you're doing.

You shouldn't write any code without knowing when you'll be done.

Corollary 1:

Although some code is a joke - some times even a WTF (also see
thedailywtf.com) - not all jokes can be used as code.

:)

Stephan
Are jokes Turing complete?

Robert
--=20
We have not succeeded in answering all of our questions.
In fact, in some ways, we are more confused than ever.
But we feel we are confused on a higher level and about more important thin=
gs.
-Anonymous
 
S

SonOfLilit

Yes, e.g. Brainfuck.

Eric said:
On Feb 16, 2007, at 08:15, Phrogz wrote:

A woman says to her Ruby programmer friend:

[...]

Unit testing gives away the punchline!

:)

I believe there are two lessons in your story:

You shouldn't write any code without knowing what you're doing.

You shouldn't write any code without knowing when you'll be done.

Corollary 1:

Although some code is a joke - some times even a WTF (also see
thedailywtf.com) - not all jokes can be used as code.

:)

Stephan
Are jokes Turing complete?

Robert
--
We have not succeeded in answering all of our questions.
In fact, in some ways, we are more confused than ever.
But we feel we are confused on a higher level and about more important th= ings.
-Anonymous
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top