[TIP] Doctest or unitest?

Nate Lowrie solodex2151 at gmail.com
Mon Mar 5 16:28:14 PST 2007


On 3/5/07, Andrew Bennetts <andrew-tip at puzzling.org> wrote:
> Michael Foord wrote:
> > Andrew Bennetts wrote:
> > >
> > >I find even normal code can have extremely obscure intent.  The "how" is
> > >always obvious (that's what code is), but the intent needs explicit care from
> > >the author if it is to be communicated to the next person to look at the
> > >code.  Good habits in naming of identifiers and the like obviously go some
> > >way to helping here, so that taking this care becomes somewhat automatic, but
> > >it needs to be taken.
> > >
> >
> > I actually disagree with this fairly strongly.
> >
> > I think good, well written code *can* communicate intent.
> >
> > This is part of the point about 'DSL's. We have the flexibility in
> > dynamic languages to write code that communicates as well as performing
> > a function.
> >
> > (For example) At Resolver our policy is to comment code as little as
> > possible - if you can't work out the intent of code then it is badly
> > written. Only in particularly obscure parts of the code (i.e. almost
> > everywhere we interact with win32 stuff!) do we comment.
>
> I don't see any part of what you say here that disagrees with what I said (or
> what I think I said...).
>
> Good, well written code absolutely can communicate intent — but if the author
> doesn't take care to make the code be good and well written, then the the intent
> won't be clear.
>
> Using a domain specific language can help, but it's no magic bullet.

As can tests, TDD, refactoring, design tools, books, etc.  It still
comes down to how the developer chooses to implement the code.

>
> -Andrew.
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
>



More information about the testing-in-python mailing list