[vtk-developers] style : Holiday greetings and a present of V TK4.0

Miller, James V (CRD) millerjv at crd.ge.com
Thu May 24 23:08:49 EDT 2001


The bracketing style was in place long before the testing and style checking. While I prefer the
starting brace to be on the same line as the "for" or "if" statement, the current style has been in
place since VTK's early days.

Regardless of the what style is used, I think it is very important for the style to consistent.  VTK
has a wide spectrum of users.  From the most experienced programmers to those that barely understand
what an object is.  Furthermore, consistent style help all the main developers maintain all the code.
I debug much more code that I am able to constribute.  So it is important for me to get up to speed
on another's code quickly.

One thing I do want to maintain is that we bracket the bodies of all "if" and "for" statements with
braces.  I've seen missing braces and improper indentation fool too many people into thinking code
lines were part of the body of an "if" or "for" block. 

Jim


-----Original Message-----
From: John Biddiscombe
To: Will Schroeder; vtk-developers at public.kitware.com
Sent: 5/24/2001 6:04 PM
Subject: [vtk-developers] style : Holiday greetings and a present of VTK4.0

At 16:51 22/12/2000, Will Schroeder wrote:

>Re: [vtk-developers] Holiday greetings and a present of VTK4.0
>Hi Folks-

One thing that I'd like to see changed is the absolutely rubbish coding 
"style".
I sympathize with the desire to unify coding style, but I have two major

objections to the current style and one gripe about people in general.

Gripe : Some people out there are clearly using tabs in the editor and
they 
are all inconsistent. Every
if (something)
   {
   do something else
   }
statement seems to be randomly spread around the screen. How about a ban
on 
tab characters or a consistent approach to their use. Use spaces for
god's 
sake, they are always the same size.

Major objection :
The use of bracketing like the above wastes space (A new line for every 
bracket). We're all experienced programmers and I for one don't mind
minor 
changes in peoples approach to coding, however the one thing that I find

most useful is a screenful of information. The current vtk style is
lucky 
to get more than ten actual lines of code on the screen an any one time.
It 
really is appalling. Seeing how the indentation moves in and out over 50

lines of well presented compact code can tell me more about how an 
algorithm behaves than any number of pages of the absolute drivel that 
comes out of half the vtk classes. Combine this with the gripe above
about 
rubbish tab spacing and it really is unreadable.
OK. It's obviously not unreadable otherwise we wouldn't manage. But all
the 
same.

Major Objection 2:
Line length. In the days when hairless deviants sat poring over
terminals 
connected to a vax mainframe via a PAD line and had green screens with a
40 
character width, it was reasonable to restrict line lengths. But these
days 
with super scrolling gui editors and fast searching clickety click mouse

control, hot keys, bookmarks and all the other modern conveniences, I
for 
one do not believe that it's necessary to have 40chars max on a line. If
an 
if statement overruns slightly, keep it on one line - AND have the
bracket 
there too if you want.

Would I be right in guessing that the current style was chosen to enable

the dashboard monitoring of defects etc to work rather than a
consideration 
of actual coding practices?

yours etc etc
JB

if (StyleChanged) {
     jumpforjoy(smiling);
} else {
     shootme(now(please));
}

works for me :)
         


_______________________________________________
vtk-developers mailing list
vtk-developers at public.kitware.com
http://public.kitware.com/mailman/listinfo/vtk-developers




More information about the vtk-developers mailing list