Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Best practices

Re: Best practices

From: Tim Cross <tcross_at_pobox.une.edu.au>
Date: 04 Jul 2002 09:19:41 +1000
Message-ID: <87n0t8z9f6.fsf@blind-bat.une.edu.au>


Daniel Morgan <dmorgan_at_exesolutions.com> writes:

>
> And yes I am definitely talking about peer review of all code ... once before it
> is written and once after it has passed unit testing by the developer.
>
> QA people can catch obvious mistakes. They can't catch subtle ones. I'll give you
> an example from a project that I worked on at one of the nation's largest banks.
>
> The code:
>
> IF acct_type = 'A' THEN
> commission_pct := X;
> ELSIF acct_type = 'B' THEN
> commission_pct := Y;
> ELSIF acct_type = 'C' THEN
> commission_pct := Z;
> END IF;
>
> If you can see what is wrong, and it is pretty obvious, great. But it managed to
> stay in their system for almost a year.
>
> What is important is to recognize is that error is so subtle that no QA technique
> known, other than a code review, could possibly catch it.
>
> If you can't catch it then ask and I'll add it to the thread. (and if I made some

OK, I'll have a go!

If I was reviewing this bit of code, my first question would be what happens if the account typ eis not A, B or C or is NULL?

For some years I worked as a consultant developing software on my own from home, which had some great benefits, but one thing which I really missed was peer review - I often learn a lot from others reviewing my code and couldn't count the number of times a peer has pointed out an error which once highlighted seems extremely obvious, but which I didn't/couldn't see before. Spotting these sort of errors in both the initial design (before any codeing) and afterwards is extremely useful and in my experience, has huge benefits to code design and implementation. There is also that class of errors which is difficult to detect in QA testing, but which an experienced developer may spot in the initial design/implementation.

Errors found and needing fixing later in the development process often require fixes which detract from the elegance/clarity of the original algorithms/code and consequently make the code more difficult to understand and therefore add to maintenance costs. Any technique which assists in identifying errors earlier has to be a benefit, even if that makes the initial implementation process slower.

Just my 2 cents.

Tim Received on Wed Jul 03 2002 - 18:19:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US