Roberto Waltman wrote:
Forgot this one: http://www.codingstandard.com/HICPPCM/index.html
I like the one that goes "never write a line of code without a failing test
case".
Specifically, the very first line I read in HICPPCM sez:
"Ensure all constructors supply an initial value (or invoke a constructor)
for each virtual base class, each non virtual base class and all non-static
data members."
Regardless of the wisdom of repeating the name of base classes, if they take
no arguments, that rule could be misconstrued to mean "supply every link to
other objects, that your object needs, in the constructor."
I know it doesn't say that. It should say "a constructor must do the minimum
to allow its destructor to call safely."
Test cases sometimes require you to construct an object _without_ its
navigable links to other objects. So the object should supply Set() or
Init() methods to then populate these objects, and it should work
well-enough without them.
I'm not sure why "An abstract class shall have no public constructors."
The point is that automated tests change these rules, and force you to obey
some of these rules.
And rules like "Use public derivation only" are flat-out wrong.
--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!