Re: Alignment Nazi?

"Gordon Milne" <[email protected]>
Newsgroups gmane.comp.programming.language-of-the-year
Message-ID <[email protected]>
Hi Mr Object Nazi, :-)

I had to remove some code form the example I posted to clarify things
a bit. The bit of code that follows the example I posted is the
construction of an adapter object which uses the [aligned] values to
construct an object called a MeasurementResult. The MR object is
classic parameter object. That is what the rest of the software uses.

Unfortunately, our MeasurementResult object needs quite a few
parameters to be useful elsewhere in the code. Not a great design but
certainly a useful one.

However, you have helped me see the error of (some) of my ways and
I'll push a fair bit of this into a really simple constructor.

Regards,

Gordon

On Mon, Apr 28, 2008 at 1:24 PM, John Carter <[email protected]> wrote:
> On Sun, 27 Apr 2008, gjmilne64 wrote:
>
>  > I am an Alignment Nazi. When I see a block of code like this:
>
>  Hi! Greetings Mr Alignment Nazi. I'm Mr Object Design Nazi! :-))
>
>  When I see long lists requiring alignment like...
>
>
>  >         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 say... "Cwap! Isn't there an easier way? Aren't bunches of these
>  things part of the same object? Shouldn't a copy constructor or a
>  factory or _something_ _anything_ save me from all this?
>
>  Maybe some of this calculation doesn't belong in the routine anyway,
>  it probably should be a method on one of these objects I pulling crap
>  out of...
>
>  Instead of going get this, that, get tom, dick and harry, and theOther
>  from an object and then calcExpression( this, that, tom, dick harry,
>  theOther) perhaps I should say... this.calcExpression(theOther)
>
>  Yes, I keep my code aligned... but large blocks of aligned stuff bug
>  me. It tells me I missing an opportunity to do better.
>
>
>  > Perhaps I should write a book (or blog) on the merits of "Pretty Code".
>
>  It should be a side note in a book on Law of Demeter, Coupling and cohesion.
>
>
>  John Carter                             Phone : (64)(3) 358 6639
>  Tait Electronics                        Fax   : (64)(3) 359 4632
>  PO Box 1645 Christchurch                Email : [email protected]
>  New Zealand
>
>
>
>  ------------------------------------
>
>  Yahoo! Groups Links
>
>
>
>
>
>
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.