Re: singleton vs static
From: Robert C. Martin (unclebob_at_objectmentor.com)
Date: 05/25/04
- Next message: Robert C. Martin: "Re: singleton vs static"
- Previous message: Hugo Kornelis: "Re: Nearest Common Ancestor Report (XDb1's $1000 Challenge)"
- In reply to: Daniel Parker: "Re: singleton vs static"
- Next in thread: Daniel Parker: "Re: singleton vs static"
- Reply: Daniel Parker: "Re: singleton vs static"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 25 May 2004 16:59:06 -0500
On 25 May 2004 10:45:52 -0700, danielaparker@hotmail.com (Daniel
Parker) wrote:
>Robert C. Martin <unclebob@objectmentor.com> wrote in message news:<3uu2b0h1e8iqgh70r094balgbohn0trhfo@4ax.com>...
>> On Sun, 23 May 2004 22:50:16 -0400, "Daniel Parker"
>> <danielaparker@spam?nothanks.windupbird.com> wrote:
>
>> >Wouldn't it be simpler to just implement a Singleton :-)
>>
>> No, since you have to write tests for implementing the Singleton
>> correctly. We certainly don't want to write any code that we don't
>> test.
>>
>Why not?
Because then we:
1. Won't know that it works.
2. Won't be able to tell if we break it sometime later.
3. Won't have a simple piece of code that explains how to use it.
4. Won't have proven that the code is decoupled enough to test.
>Why would I want to spend time testing things that have
>never proven to be a problem in practice?
So that you don't have to debug it later.
>Development time is a
>scarce resource
Yes.
>and has many claims on it.
Yes, yes.
>There is no point writing
>more tests if the incremental gain approaches zero.
When you can measure that incremental gain with precision, and *know*
that it approaches zero, then you can make that statement. Guessing
at the incremental gain is not acceptable.
If my accountant told me that he didn't have to practice dual entry
bookkeeping because he was very good at adding, I'd find a new
accountant.
If a programmer tells me he doesn't need to write tests because the
incremental gain is insignificant, I'll find a new programmer. After
30+ years in this game I *know* how significant an insignificant bug
can be. I'd rather have the tests, they'll save me a lot more time
than having the programmers guess at when the incremental gain is
significant.
-----
Robert C. Martin (Uncle Bob)
Object Mentor Inc.
unclebob @ objectmentor . com
800-338-6716
"The aim of science is not to open the door to infinite wisdom,
but to set a limit to infinite error."
-- Bertolt Brecht, Life of Galileo
- Next message: Robert C. Martin: "Re: singleton vs static"
- Previous message: Hugo Kornelis: "Re: Nearest Common Ancestor Report (XDb1's $1000 Challenge)"
- In reply to: Daniel Parker: "Re: singleton vs static"
- Next in thread: Daniel Parker: "Re: singleton vs static"
- Reply: Daniel Parker: "Re: singleton vs static"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]