Am Thu, 30 Sep 2010 14:19:37 +0200
schrieb Frank Schönheit <frank.schoenh...@oracle.com>:

> Hi Stephan,
> [...]
> > The trick is to let writing tests guide you when writing an 
> > implementation, so that the resulting implementation is indeed
> > (unit) testable.  See for example 
> > <http://www.growing-object-oriented-software.com/> for some food
> > for thought.  However, how well this works out for us needs to be
> > seen, indeed...
> 
> Well, this "the trick is ..." part is exactly why I think that
> issueing a statement like "from now on, we do tests for our code"
> won't work - this is a complex topic, with a lot of "tricks" to know,
> so "Just Do It!" is an approach which simply doesn't work. But okay,
> that's a different story.

I beg to differ: If code is not testable, it is not good and needs to
be changed. If you fear to change it because it is complex and has
weird dependencies, you have two choices:
- make it testable and the world will be a better place
- leave the design as is, actually make it worse by adding workarounds
  that do not really fit in the old design. If you shied away from
  changing the design, the next change to the code will be even more
  daunting. And there will be a next change. There always is.

You probably say now: "I know, but ...". If you do, take a step back and
meditate about if there can be any "but" that will be valid against the
fundamental truth that we need unit tests for the messy code we have and
we even more need unit tests for the messier code we have. There isnt.

So "Just Do It!" is exactly the right thing to do, even if -- and
maybe because -- it not a comfortable road to take.

"We choose to write unit tests, not only because they are easy, but
because they are hard, because that goal will serve to organize and
measure the best of our energies and skills, because that challenge is
one that we are willing to accept, one we are unwilling to postpone,
and one which we intend to win, and the others, too."
 -- paraphrasing JFK at Rice ;)

Best Regards,

Bjoern




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org

Reply via email to