Re: Alignment Nazi?
Al Chou <hotfusionman-/[email protected]>
| Newsgroups | gmane.comp.programming.language-of-the-year |
|---|---|
| Message-ID | <[email protected]> |
The closest I ever came to using a card punch was when my dad brought me with him on occasion to the computer center where he was working on his Ph.D. research. Like your advisor, he too kept the card decks, in the special sized corrugated cardboard boxes, for years after he could no longer possibly have found a card reader to have them fed into. And he wasn't even a programmer by trade, he was a psychologist who had merely used the computer for his statistics. I wouldn't say that Python is the new FORTRAN -- quite the opposite. Whereas whitespace after the first 6 columns is not significant to a FORTRAN compiler, indentation is of utmost importance to a Python parser, as I'm sure you know. So, you can muck with whitespace quite a lot in FORTRAN source code -- even in the first 6 columns -- and still be able to repair the formatting in an automated way to the point that it is parseable to the same meaning as the original un-mucked-with code. Python code whose indentation has been modified can easily require human interpretation to restore the indentation back to the original intention. Al ----- Original Message ---- > From: Gordon J Milne <[email protected]> > To: [email protected] > Sent: Wednesday, May 14, 2008 11:22:59 PM > Subject: Re: [pragprog] Alignment Nazi? > > Al, > > I never had to deal with card decks since I escaped, by one year, the > requirement to use the punch card generator when I took first year > computer science at the University of Aberdeen. > > Several of the behemoths, however, lingered outside the fanfold paper > based DecWriter teletype room for the best part of a semester before > they were carted off for disposal. I often wanted to try using one just > to see what it was like but they had been disabled. > > Several years later, whilst I was undertaking a PhD, I came across boxes > and boxes of Fortran 66 code, on card, in the basement lab of my > supervisor. Everything had been moved to tape ages ago but, for some > reason, he kept hold of the cards. Apparently, the computer center still > had a functional card reader. Just in case! > > Mind you though, your train of thought regarding Python has made the > following thought pop into my head. With indentation being some > important to Python. Is Python the new FORTRAN? :-) > > Regards, > > Gordon > > Al Chou wrote: > > P.S. A Niven-Pournelle Inferno-esque punishment for those who destroy the > careful code formatting of others could be to have to maintain FORTRAN 66 code > converted from card decks that omitted all non-significant whitespace (one can't > arbitrarily muck around with the first 6 columns) to cram more code onto each > card. > > > > Al > > > > > > ----- Original Message ---- > >> From: Al Chou > >> To: [email protected] > >> Sent: Wednesday, May 14, 2008 11:05:41 PM > >> Subject: Re: [pragprog] Alignment Nazi? > >> > >> Yeah, I agree that if they don't care what the code looks like, they > shouldn't > >> change what it looks like. But having formatting wars between two or more > >> varieties of code Nazis is even a bigger expenditure of time, hence Steve > >> McConnell's recommendation to auto-format the code on checkout to your > personal > >> preference and auto-format back to the organization's standard upon checkin. > As > >> I mentioned earlier, I don't think Python was the language he had in mind > when > >> he wrote that. > >> > >> As you mention, with modern IDE's and even editors that predate those, it's > easy > >> to auto-format code. What baffles me nowadays is people to whom it never > occurs > >> that the editor could auto-indent code for them. I always shake my head when > I > >> hear the space bar being hit several times right after the return key. A > less > >> obvious example of a feature that could help a lot of people but isn't always > > >> used is word auto-completion. It's probably used more often in code editors > >> than in word processors, but given how much more often the latter are used in > > >> the universe of computer users, it's almost criminal that the more popular > word > >> processors don't do completion by default the way OpenOffice.org does. I'm > >> always gratified and amazed at how much faster I can type a document in it > than > >> in Word, say. > >> > >> > >> Al > >> > >> > >> ----- Original Message ---- > >>> From: Gordon J Milne > >>> To: [email protected] > >>> Sent: Wednesday, May 14, 2008 10:20:21 PM > >>> Subject: Re: [pragprog] Alignment Nazi? > >>> > >>> Al, > >>> > >>> I suppose that means I ain't a big enough Nazi to be an Alignment Nazi. > >>> > >>> My personal beef about this topic (in general) is mainly with co-workers > >>> who pay no attention whatsoever to any kind of alignment-for-clarity > >>> that their colleagues might employ to make things easier on their > >>> brains. I fully admit to having a limited brain. > >>> > >>> During the past 19 years I have met many developers who don't give a > >>> hoot about how their code looks. However, they usually have the decency > >>> to ensure that code that has been carefully formatted is left that way. > >>> I have only met a handful of developers that don't even care about that. > >>> These people annoy the hell out of me, and they know that too. I work > >>> with one of these people now. He excuses himself by saying his text > >>> editor is the culprit. Frankly, his inattention to detail on checkins is > >>> at fault. This is very easy to get right with modern IDEs. > >>> > >>> I think I might start questions about code style the next time I hire > >>> somebody. I'm fed up with working with people that think all that > >>> matters is what the compiler generates. > >>> > >>> Hell, we write the code for each other, not the compiler. > >>> > >>> Regards, > >>> > >>> Gordon > >>> > >>> Al Chou wrote: > >>>> Gordon, > >>>> > >>>> I'm sorry, I can't let this one just slide by. If I were an Alignment > Nazi, > >> I > >>> would not let the difficulty of realignment get in the way of a needed > rename > >>> refactoring. I would find a tool to do the desired realignment. For > example, > >>> someone mentioned in this thread that EMACS can do it, IIRC.... > >>>> > >>>> Al > >>>> > >>>> > >>>> ----- Original Message ---- > >>>>> From: Gordon J Milne > >>>>> To: [email protected] > >>>>> Sent: Wednesday, May 14, 2008 8:04:38 PM > >>>>> Subject: Re: [pragprog] Alignment Nazi? > >>>>> > >>>>> Ged, > >>>>> > >>>>> Personally, I would not care what happened on such a rename operation. > >>>>> It is unlikely, however, that the temperature class would be renamed > >>>>> since it is one of our basic, low-level utility classes. In any event, > >>>>> if such a rename were performed I would expect things to get realigned > >>>>> when someone had reason to delve into that area of the code, otherwise I > >>>>> would not care. > >>>>> > >>>>> FYI, if I was the person doing the rename, I'd probably realign > >>>>> everything because I'm wired that way. However, I'd probably take the > >>>>> pragmatic road and abort the rename once I saw how many changes in the > >>>>> code base it would produce. > >>>>> > >>>>> Regards, > >>>>> > >>>>> Gordon > >>>>> > >>>>> Ged Byrne wrote: > >>>>>> Gorden, > >>>>>> > >>>>>> My question is what happens if the Temperature class is renamed to > >>>>>> something longer? Do you have to go through all of the classes that > >>>>>> declare a Temperature instance and move every single = to maintain > >>>>>> alignment? > >>>>>> > >>>>>> Are you forced to keep names short, so that alignment is easy? Would > >>>>>> you prefer correct alignment over descriptive names? > >>>>>> > >>>>>> If names aren't kept short, then you start having to scroll sideways > >>>>>> in the IDE and word wrap in the printouts. Is that desirable? > >>>>>> > >>>>>> I've been working with SQL that uses the same type of alignment > >>>>>> scheme, and these are the problems I've been encountering. > >>>>>> > >>>>>> > >>>>>> Ged. > >>>>>> > >>>>>> On Sun, Apr 27, 2008 at 11:06 PM, gjmilne64 wrote: > >>>>>>> Hi! > >>>>>>> > >>>>>>> I am an Alignment Nazi. When I see a block of code like this: > >>>>>>> > >>>>>>> final int counts = result.getCounts(); > >>>>>>> final int periodMicros = result.getMicros(); > >>>>>>> final Rate rate = new Rate(new