Re: Real world coding standards implementation feedback
On May 20, 12:06 am, Jeff Schwab <j...@schwabcenter.com> wrote:
Phlip wrote:
daniel.coudr... wrote:
we are in the process of selecting / devising a C++ coding
standard to use internally to our company our be able to
provide feedback to our customers about.
How about "every line of code, every branch, and every
argument shall have documenting unit tests"?
Define "documenting unit tests". A unit test doesn't document
anything. And passing a unit test doesn't prove readability.
Unit tests are an essential part of the development process (and
given the possible standards cited by the original poster, and
the environment from which they come, I'm rather certain he's
aware of this). But you still need guidelines for such basic
things as naming conventions, indentation, file organization...
100% code coverage means you screwed something up. Any
non-trivial project contains unreachable code. That code
exists only to handle assertion failures, unexpected default
cases in switch statements, etc.
It's never meant to be executed; it's only there as documentation.
That's true to a point, but an assertion is more than
documentation---a failed assertion means that there is an error
elsewhere in the code. And while I don't normally plan it that
way, the failed case in the assertion often ends up being
"tested" before the working case.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
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