[Zope3-dev] Progress

Jim Fulton jim@zope.com
Tue, 05 Mar 2002 13:36:21 -0500


Martijn Faassen wrote:
> 
> Chris Withers wrote:
> [snip a lot of stuff about test first, XP stuff, etc]
> 
> A general comment. I agree with Stephan that sometimes writing tests
> first isn't the route *my* brain can handle; it indeeds requires a good
> understanding of the problem domain, and sometimes the best way for me
> to gain this understanding is to experiment or write a prototype; i.e.
> write code before tests. One can have a whole religious debate about
> extreme programming ideology, but we should be pragmatists first. And we
> should realize not everyone's brain works in the same way, so we're
> not all going to approach problems the same way. Some people are more
> up-front design, some people are more hands-on.

Prototyping is a good thing and is often appropriate before tests, however,
we need to be really skeptical when a bunch of code is written without
tests. My observations are:

- Writing unit tests is a royal pain in the ass, but it's almost always
  worth the effort.

- It is doubly or triply hard writing tests for code that already works.
  That's why the XP people want the tests written first. I'm skeptical that
  decent tests will be written after the code runs.

I worry that if the problem isn't well enough understood to write 
tests, the software written will be, um, problematic. It doesn't
matter for throw-away prototypes, but it does for software that will eveolve.

> That's not to say everyone should just get away with everything as
> they can claim their brain is different -- just to provide a bit of
> moderation into this debate. Unit tests good. Clear interfaces good.
> We all agree on that.

Here's a compromise position.

Only throw-away prototype code should be checked in without writing tests first.
Such code should not be checked into the Zope3 tree. The only reason 
it should be checked in is to allow geographically separated people
to collaborate on it.  Maybe there should be a separate area in cvs.zope.org
for such efforts.

Throw-away code must be thrown away.  When it's time to write the evolutionary
code:

  - Write the necessary interfaces

  - Write the unit tests

  - Write the *new* code.

> I however agree with Chris' worry that lots of changes are going to be
> checked in without a bit more debate.

Me too.  

Jim

--
Jim Fulton           mailto:jim@zope.com       Python Powered!        
CTO                  (888) 344-4332            http://www.python.org  
Zope Corporation     http://www.zope.com       http://www.zope.org