Re: Re: Alignment Nazi?

Al Chou <hotfusionman-/[email protected]>
Newsgroups gmane.comp.programming.language-of-the-year
Message-ID <[email protected]>
Steve McConnell's _Code Complete_ (the first edition, anyway; I haven't read the second edition) advocates using auto-reformatters on source code upon checkin to the revision control system to enforce a team/corporate code formatting standard, thus allowing individual developers to do whatever they want to the code in terms of the visual aspects of source code formatting in their own environments.

The idea makes more sense in the C/C++/similar environment that I recall pervades the book; less sense in a language like Python, where a mere compiler/interpreter cannot necessarily discern what the code is supposed to do and thus it is not always possible to figure out what the correct formatting should be, when the formatting does not correctly reflect the intent behind the actual code.  I learned this fact when I read _Thinking in Python_ on a Palm device after converting the original downloadable version to a Palm-compatible file format.  The conversion utility had discarded leading whitespace on every line.  In order to reformat the example code in the book to provide indentation, I had to read it and figure out what it was trying to do -- something it would have been much harder for
  a machine to do than counting begin/end or curly brace pairs, which is easy by comparison.


Al


----- Original Message ----
> From: Andrew Semprebon <[email protected]>
> To: [email protected]
> Sent: Monday, April 28, 2008 4:27:18 AM
> Subject: Re: [pragprog] Re: Alignment Nazi?
> 
> On Mon, Apr 28, 2008 at 3:21 AM, Jeroen Wenting
> wrote:
> >
> > nope. Generally only functional changes should make it into version
> > control.
> 
> I guess adding/correcting comment is out then...
> 
> > OTOH it makes it a lot more work changing that code as every time
> > someone comes up with variable name that including its type name is
> > longer than anything that's already there an ever expanding block of
> > code needs to be rewritten to please your fetish.
> > Makes tracking diffs a lot harder when half the sourcefile changes
> > every time someone touches it just to make it match his personal
> > layout preferences.
> 
> On the third hand, In most places I have worked, once the code if
> formatted into something decent, developers won't change it just to
> fit their preference (although their IDE may do that for them), so I
> think its worth while to get poorly (or worse, misleadingly indented)
> code into shape. Why should everyone else have to read poorly indented
> code forever more just because the original developer did a poor job
> in the first place? Of course, the real solution is to fire that guy
> who cares so little about his work products that he checks in the
> poorly laid-out code.
> 
> -- 
> --
> Andrew Semprebon * http://semprebon.blogspot.com/


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.