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!

"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!