Re: Coding Standards
On Sep 6, 4:38 am, Ian Collins <ian-n...@hotmail.com> wrote:
James Kanze wrote:
On Sep 5, 6:31 pm, Phlip <phlip2...@gmail.com> wrote:
James Kanze wrote:
In particular, you can't
write a single line of code (unit test or implementation) before
you know what the function should do,
I didn't bring up TDD, but if you are curious enough about it
to keep asking these entry-level FAQs,
I'm not asking anything. I'm simply stating an easily
established fact, which wishful thinking seems to cause some
people to ignore. Tests definitly have their role, but until
you know what the code should do, you can't begin to write them.
And until you've written something down in black and white, you
don't know it.
I think we ares starting form a different definition of "know what the
code should do".
Those of us who use TDD, tend to use plain customer language stories as
our requirements. A recent example I had was "add a new type of alarm
that combines up to 10 existing alarms". From another, completely
non-technical customer "Add a notes box if the user selects red".
Writing the requirements specifications is an iterative process.
Obviously, given requests like the above, you start by getting
more information, and writing up some sort of more detailed
requirements for the customer approve.
I wonder if part of the problem isn't that you are confusing
prototyping with testing. For interactive programs, some degree
of prototyping is often useful, or even essential, in order for
the user to really see the impact of what he is approving. And
such a prototype can be part of the requirements specifications:
if event x occurs, the application should visually behave as the
prototype does. But a prototype is not the application. You
still need to specify a lot of "invisible" behavior. (Load
requirements, failure modes, synchronization requirements, etc.
See my other response to you for some concrete examples.)
And of course, prototyping is not necessarily relevant to
everything. If you're implementing an LDAP server, for example,
you don't really need to prototype; the protocol is already
specified, and the customer isn't going to change it.
James Kanze (GABI Software) email:firstname.lastname@example.org
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34