Re: Alignment Nazi?
Vic Williams <[email protected]>
| Newsgroups | gmane.comp.programming.language-of-the-year |
|---|---|
| Organization | Facilitating process - strategy - training |
| Message-ID | <[email protected]> |
Hi, Actually this meshes with Christopher Alexander's pattern work. You're probably seeing the line by line and overall. And my guess is that you can sense (code smell?) rightness to some extent by your overall view. I think that's why you can find book recommendations for shorter c functions. They let people see and hold the program in one's mind. We have an awful job with mainland Chinese who are used to their calligraphy, where every character is important. They are often unable to overview. They make the overall result look good but they look too much "word" by "word" instead of by line 'rightness', or by block 'rightness'. gjmilne64 wrote: > 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 > Duration(periodMicros, Duration.MICROSECOND), counts); > final Current reagentIntensity = > upsElectrometer.getValue(); > final Current productIntensity = > dwsElectrometer.getValue(); > final Temperature flowtubeTemperature = > flowtubeThermocouple.getValue(); > final Pressure flowtubePressure = > flowtubePressureGauge.getValue(); > final FlowRate carrierFlow = reagent.getIon().isPositive() ? > pcgFlowMeter.getValue() : nicgFlowMeter.getValue(); > final FlowRate sampleFlow = sampleFlowMeter.getValue(); > final Duration reactionTime = getReactionTime(carrierFlow); > final Lut ICF_LUT = > CONFIG.getLut(DefaultConfigIfc.ConfigId.ION_ICF_LUT); > > I find it so much easier to read when I change it to this: > > final int counts = result.getCounts(); > final int periodMicros = result.getMicros(); > final Rate rate = new Rate(new > Duration(periodMicros, Duration.MICROSECOND), counts); > final Current reagentIntensity = > upsElectrometer.getValue(); > final Current productIntensity = > dwsElectrometer.getValue(); > final Temperature flowtubeTemperature = > flowtubeThermocouple.getValue(); > final Pressure flowtubePressure = > flowtubePressureGauge.getValue(); > final FlowRate carrierFlow = > reagent.getIon().isPositive() ? pcgFlowMeter.getValue() : > nicgFlowMeter.getValue(); > final FlowRate sampleFlow = > sampleFlowMeter.getValue(); > final Duration reactionTime = > getReactionTime(carrierFlow); > final Lut ICF_LUT = > CONFIG.getLut(DefaultConfigIfc.ConfigId.ION_ICF_LUT); > > Of course, this works so long as you use a monospaced font in your editor. > > The question I want to ask is "does my need for visual clarity excuse > my /fetish /for alignment of equals signs in blocks of code"? > > My personal justification is that I can more easily assimilate the > block of code if the left-hand side of variable names is clearly > separated from the right-hand side of assignments. I don't know why my > brain finds this easier, it just does. What amazes me, however, is how > many of those I have worked with over the years have no problem with > the the former code layout. -- “The worse the society, the more law there will be. In Hell, there will be nothing but law, and due process will be meticulously observed.” -- Grant Gilmore (The Ages of American Law 1977, p. 111) Vic Williams 13066824980