Re: Alignment Nazi?
"James Ashley" <[email protected]>
| Newsgroups | gmane.comp.programming.language-of-the-year |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Apr 28, 2008 at 1:10 AM, Stefan Schmiedl <[email protected]> wrote: > On Sun, 27 Apr 2008 19:25:37 -0400 > "Avdi Grimm" <[email protected]> wrote: > > > On Sun, Apr 27, 2008 at 6:06 PM, gjmilne64 <[email protected]> wrote: > > > 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. > > > > Does anyone who has been coding longer than a day use a non-monospaced font? > > Yes. In Smalltalk. All the time. Bitstream Vera Serif 10pt or 11pt > depending on the display. Much easier on the eyes than those punchcard > reminders ;-> I used to have a manager (a FoxPro guy) who used variable width fonts. Something about being able to fit more text onto a single line, or some such. Personally, I think both examples are silly and anal. Given the caveats from the other tyrants who've pointed out that this code has a smell (and a "Why are you doing this in java? That is java, isn't it?" reaction), I personally tend to the opposite of you: final int counts = result.getCounts(); final int periodMicros = result.getMicros(); final Rate rate = new Rate(new Duration(periodMicros, Duration.MICROSECOND), counts); final Current reagentIntensit = 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); To my eyes, that just flows and reads more easily. And it's a lot easier to maintain. Then again, I also dislike Hungarian notation, mainly because I've never run across any company that actually uses it correctly (at the same company with the FoxPro guy, we had to prefix all variable names with an o because they were objects). It's all a matter of perspective, personal perspective, and experience. Beauty is in the eye of the beholder. Shrug, James