On May 17, 11:40 pm, cpp4ever <n2xssvv.g02gfr12...@ntlworld.com>
wrote:
On 16/05/11 23:57, Andrew wrote:
Any comments? Do they add value? Why? What kind of stds?
The major reason, (in no particular order), IMHO for coding standards is
to help provide code that
1 ... Can be more easily understood, (avoid large functions and obfuscation)
Large functions and obfuscation, eh? I haven't seen many coding stds
that address these... How?
2 ... Can be consistently applied to version control, (consistent coding
style)
Hmm. Consistent style is a rule, not a benefit of having the rule.
What do you mean? What has it got to do with version control?
3 ... Can allow for future development
Not seen many coding stds address this one either. Can you elaborate?
4 ... Can avoid long compile times, (multiple dependencies)
I have only seen one piece of work that addresses this one and that is
Large Scale C++ Design by John Lakos. IMO it was quite good in its day
(yes, I have a copy) but has been eclipsed by language changes, more
conformant compilers and changes to practices. For example, the
external include guards it talks about are actually prohibited by the
Sutter/Alexandrescu coding stds! So how did you think that coding stds
can help avoid long compile times? Most coding stds do not address
issues of physical design.
5 ... Allow for testing during development
Testability is a laudable goal but I have not seen this addressed by
coding stds yet.
6 ... Allow for regular code reviews, (better to catch problems early)
Code reviews are not a benefit of having coding stds. They are the
means of enforcement.
I still don't see what the benefits are from what you have said.
I think we all agree that a consistent style is nice and that good
coding stds make for a more pleasant developer experience. This is why
I have advocated their use in the past. But (playing Devil's Advocate,
slightly) what is the software engineering benefit? How will it make
the code less prone to bugs, easier to debug, easier to adapt, tune,
port etc etc?
High cohesion and low coupling are aspects of good design that make
code easier to change and debug. But it is rare that coding stds
address issues such as those. They are not always mentioned in code
reviews either (people tend to concentrate on rules that are being
broken).
Regards,
Andrew Marlow
Nice to know the devils advocate is out there. But if coding standards
except to make some busy body feel important without adding any value.
coding standards should be part of that.
[ comp.lang.c++.moderated. First time posters: Do this! ]