[vtk-developers] vtk Coding style : Proposed change
Andrew Maclean
andrew.amaclean at gmail.com
Sun Mar 26 17:31:54 EST 2006
John, I don't like the idea.
I realize it is an effort to convert to the VTK coding style, but I think
that coding styles should be consistent throughout a library. Otherwise it
gets difficult to read code as you constantly have to switch styles. It also
increases the possibility of missing subtle errors.
Surely it is not that much effort to fit in with the VTK style. With modern
text editors it should be simple to reformat. I think someone at VTK has
some scripts for this . but I may be wrong. I know there is an EMACS thingie
for VTK formatting floating around somewhere.
I don't use their style either and for the vtkParametric functions I had to
convert to their style. It took a bit of time but it also had the advantage
that when doing it I had to read the code and fixed up a few oddities etc.
in the code.
Regards
Andrew
_____
From: vtk-developers-bounces+andrew.amaclean=gmail.com at vtk.org
[mailto:vtk-developers-bounces+andrew.amaclean=gmail.com at vtk.org] On Behalf
Of John Biddiscombe
Sent: Sunday, 26 March 2006 05:37
To: vtk-developers
Subject: [vtk-developers] vtk Coding style : Proposed change
Dear vtk developers,
I have a number of modules that I would like to (and have been asked to)
contribute in the near to mid-term future but I do not wish to reformat my
code to fit the vtk coding style. If (for example) vtkNetCDFReader is
contributed to vtk/paraview, I will most likely be doing the majority of
maintenance and fixing work on the class(es). I do not like the vtk coding
style as I find it hard to quickly mentally parse (bracket indentation in
particular) and I would like to reserve the right to use my own coding style
on the contributed class(es). I can digest and debug my own code
considerably faster because I am familiar with the way it is structured and
laid out.
I would like therefore to propose that the vtk coding style (as described
here http://www.vtk.org/Wiki/VTK_Coding_Standards ) be modified to include
the following (additional text in red - apologies for non html capable email
readers)
* The indentation style can be characterized as the "indented brace"
style. Indentations are two spaces, and the curly brace (scope delimiter) is
placed on the following line and indented along with the code (i.e., the
curly brace lines up with the code). Example:
[example deleted]
* Code contributions/modifications should use the accepted vtk coding
style as outlined in this document, with the exception that contributions
which consist of new modules in their entirety are permitted to use their
own style - provided the style is consistent throughout the whole
contributed module.
* Modifications to existing code must follow the coding style of the
module being changed. If the code being changed is a contributed module
which deviates from the accepted vtk style then the changes should attempt
to follow the contributed style.
To summarize my changes in a nutshell :
Any fixes/modifications/additions to existing code must follow the
coding style of the module being modified : In the vast majority of cases
this means that the standard vtk coding style must be used. All existing
classes must continue to use the vtk coding style. But I (for one) would
like to be able to contribute new code in my own style and anyone modifying
the code I have contributed should follow the style I have used in the
module as best they can.
If this proposal is accepted, then I will be happy and will (hopefully)
never need to raise the issue of coding style again. I have asked in the
past to change the style, but met with opposition, I believe the wording of
my proposition above is flexible enough to satisfy myself and others without
opening the doors to complete corruption of the existing code-base. Please
feel free to propose further changes to my text, but do not dismiss out of
hand my proposition as I believe that the majority of vtk developers are
capable of coping with different styles providing they are consistent. In
general very few vtk users (or indeed developers) study the source code in
great depth for modules other that those that they are making use of
heavily, (and have problems with). I find it acutely painful to reformat
code that may be thousands of lines long into a style that I don't like, for
nobody's benefit.
NB : One possible addition to my proposal might be that modules deviating
from the standard vtk style should contain a disclaimer
"This class uses a different coding style to the vtk standard, please pay
careful attention to code layout when debugging"
yours
JB
--
John Biddiscombe, email:biddisco @ cscs.ch
http://www.cscs.ch/about/BJohn.php
CSCS, Swiss National Supercomputing Centre | Tel: +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtk-developers/attachments/20060327/41853fa8/attachment.htm>
More information about the vtk-developers
mailing list