Why Unit Testing sucks

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!

:slight_smile:

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

A woman says to her Ruby programmer friend:

[…]

Unit testing gives away the punchline!

:slight_smile:

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.

Eric H. wrote:

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.

:slight_smile:

Stephan

On 2/17/07, Stephan Kämper removed_email_add[email protected] wrote:

:slight_smile:

Stephan

Are jokes Turing complete?

Robert

On Feb 18, 2007, at 11:20 AM, Robert D. wrote:

Are jokes Turing complete?

No. And nerd-humor is NEVER funny.

On Feb 18, 2007, at 9:02 PM, Albert Ng wrote:

But that’s not the point, is it?

It isn’t?? Tell me, exactly what was the point?

But that’s not the point, is it?

On 2/19/07, Ryan D. [email protected] wrote:

On Feb 18, 2007, at 11:20 AM, Robert D. wrote:

Are jokes Turing complete?

No. And nerd-humor is NEVER funny.

It is to us nerds (:

m.

On Feb 16, 9:10 am, “Phrogz” [email protected] wrote:

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.

Yes, e.g. Brainfuck.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs