Reply to Re: how do professional PHP developers handle defaults for function parameters?

Your name:

Reply:


Posted by Dikkie Dik on 07/14/07 13:24

>> Do you think that documentation can be replaced by unit tests?

> That's like asking if ice cream will replace airplanes. They are two
> entirely different things.

No they're not. Unit test demonstrate the behaviour of the code. Both
the good behaviour and the bad. The accepting of a task, the rejecting
if it, and even defaults and special environments.

Any diagrams I have go with the unit tests. For a few good reasons:
- There is no documentation. Even if there is, it is probably outdated,
beyond reach of developers or has never existed. The real problem with
normal documentation is that it is complete decoupled from the code and
has therefore nothing to do with it. Even <language>Doc tags are usually
wrong, as they are just comments and are therefore not compiled. The
code is the documentation, as it is the only thing you can rely on to be
accurate.
- You run the tests before you start your work. So you see them. Every
day. More than once a day. Your face is put into it, in the most heavy
way that does not include violence. You know it exists. You know where
it is. Hey, you might as well read them.

For your info, unit tests are not a collection of red and green lights.
They are a collection of self-explanatory tests, stating what input they
offer, and what output is expected. AND they demonstrate that the code
actually works that way. They also demonstrate "programming flow" like
the need to call special initializers or disposers.

Best regards

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация