Re: Alignment Nazi?
John Carter <[email protected]>
| Newsgroups | gmane.comp.programming.language-of-the-year |
|---|---|
| Message-ID | <[email protected]> |
Rant number two.... On Sun, 27 Apr 2008, gjmilne64 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. Of course, this works so long as you use a Monospaced font and use the "use spaces not tabs" editor setting.... Sorry, that isn't Rant Number Two... This is.. Bad code is endemic in functions originating in a mathematical or engineering domain. Why? Because, like all Good Mathematicians, we expand the terms in an expression as much as possible looking for further opportunities for simplifications / cancellations / application of identities / theorems etc. What engineers and mathematicians _never_ do is... Once they have the expansion as simple as possible, they forget to reverse the expansion to make the expression as simple as possible, invoking methods on the appropriate objects. So instead of seeing simple, understandable, maintainable code, scientific and mathematical computing contain dense nests of formulae which are functions of several tens of variables. You'd never make such as mess thinking as a Objected Oriented Designer facing the problem as a Object Orient Design issue. On which object do these attributes belong? On which object does this method rightfully belong? But somehow an expression coughed up by the Big Brain Engineer / Mathematician / ... is sacred and is implemented, usually buggily, as a huge monolithic, badly tested, function containing many stack variables and subexpressions. Rant over... (for now). John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : [email protected] New Zealand