Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #23413

Re: Inserting Multiple Lines from Console

Path csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail
From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Inserting Multiple Lines from Console
Date Wed, 10 Apr 2013 14:43:39 -0400
Organization A noiseless patient Spider
Lines 103
Message-ID <kk4bnt$9da$1@dont-email.me> (permalink)
References <e88303ce-910f-4aad-af1a-895ce3ca4a8b@googlegroups.com> <Texteditor-20130408160509@ram.dialup.fu-berlin.de> <1g78uhsyrvwdo.wcwiwmnmky0$.dlg@40tude.net> <MmG8t.110815$8d.85821@newsfe14.iad> <51dbac84-c063-43fa-b7cc-7a86fbf50a29@googlegroups.com> <87r4ik8vu0.fsf@xopzuey.i-did-not-set--mail-host-address--so-tickle-me> <e9643093-3765-490b-ab6f-0626af042ff8@googlegroups.com> <stQ8t.185632$m21.117009@newsfe02.iad> <87d2u246v9.fsf@xopzuey.i-did-not-set--mail-host-address--so-tickle-me>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
Injection-Date Wed, 10 Apr 2013 18:41:02 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="0d73d8cc209bff1c6395088b400d0605"; logging-data="9642"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1958EmIVS5EbCrFo4Zu7cW+"
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5
In-Reply-To <87d2u246v9.fsf@xopzuey.i-did-not-set--mail-host-address--so-tickle-me>
Cancel-Lock sha1:rnLXyqyhpac/pEAVlQzqGcAAxIQ=
Xref csiph.com comp.lang.java.programmer:23413

Show key headers only | View raw


On 4/10/2013 1:45 PM, znôrt wrote:
> Arved Sandstrom <asandstrom2@eastlink.ca> writes:
>
>>> Formatting changes introduce more to review and get wrong. They are
>>> frowned upon.
>>
>> The problem there sounds more like unclear ownership
>
> if there is a problem at all with formatting you can use a centralized
> mandatory style configuration shared by all developers, and automatic
> formatting on save. voilà.
>
> of course this only applies to "professional programming environment
> with source control and code reviews" (which is the current context),
> where you have control over the tools.
>
> once you do that you never bother again on formatting or styling issues,
> not for a second, and bytheway realize that poor code quality has
> absolutely nothing to do with formatting or style at all.

     Why do so many programming languages -- including Java --
allow the programmer the freedom to use arbitrary amounts of
white space between tokens?  Perhaps it's to give petty tyrants
something to obsess about: As long as they're busy insisting on
their own rigidly-defined white space allocation rules, they'll
perhaps lack the energy to do something more troublesome.

     Meanwhile, mechanically allocated white space is occasionally
a bad thing.  Case in point: I recently wrote a bit of code to
solve a small system of linear equations using Cramer's Rule.  You
may recall that this involves calculating matrix determinants --
that's one reason it's not especially good for large equation sets,
but this one was only three-by-four.  So I wrote myself a method
of nine arguments, and called it like this:

	double d = determ(sumXX, sumXY, sumX,
	                  sumXY, sumYY, sumY,
	                  sumX,  sumY,  n   );

	double a = determ(sumXC, sumXY, sumX,
	                  sumYC, sumYY, sumY,
	                  sumC,  sumY,  n   ) / d;

	double b = determ(sumXX, sumXC, sumX,
	                  sumXY, sumYC, sumY,
	                  sumX,  sumC,  n   ) / d;

	double c = determ(sumXX, sumXY, sumXC,
	                  sumXY, sumYY, sumYC,
	                  sumX,  sumY,  sumC ) / d;

See the nice, neat three-by-three matrices? See how the column
of right-hand sides (the ...C terms) marches neatly across the
tableau? See Cramer's Rule exactly as your high-school algebra
textbook pictured it?

     Along came the ever-helpful mechanical formatter:

	double d = determ(sumXX, sumXY, sumX,
	        sumXY, sumYY, sumY,
	        sumX, sumY, N);

	double a = determ(sumXC, sumXY, sumX,
	        sumYC, sumYY, sumY,
	        sumC, sumY, N) / d;

	double b = determ(sumXX, sumXC, sumX,
	        sumXY, sumYC, sumY,
	        sumX, sumC, N) / d;

	double c = determ(sumXX, sumXY, sumXC,
	        sumXY, sumYY, sumYC,
	        sumX, sumY, sumC) / d;

See the matrices?  They're still there, if you sort of tilt your
head to the side and squint a little; it may help if you're slightly
astigmatic.  See the right-hand sides in their systematic little
dance?  Not I, not with all the head-tilting my vertebrae can manage.
Somebody's insistence on his own notions of formatting (as embodied
in the mechanical formatter) transformed my code from crystal-clear
to opaque and ugly.

     Perhaps I should just be thankful it left the line breaks
in place.  It doesn't always, you know!  About a month ago I used
this well-known pattern:

          Quotation quo = new Quotation.Builder()
                  .setDate(elt.getAttribute(DATE))
                  .setPrice(elt.getAttribute(PRICE))
                  .setSize(elt.getAttribute(SIZE))
                  .setSource(elt.getAttribute(SOURCE))
                  .build();

... which the friendly formatter turned into:

          Quotation quo = new 
Quotation.Builder().setDate(elt.getAttribute(DATE)).setPrice(elt.getAttribute(PRICE)).setSize(elt.getAttribute(SIZE)).setSource(elt.getAttribute(SOURCE)).build();

... after which the check-in system dinged me for line length.

-- 
Eric Sosman
esosman@comcast-dot-net.invalid

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Inserting Multiple Lines from Console subhabangalore@gmail.com - 2013-04-08 06:59 -0700
  Re: Inserting Multiple Lines from Console Joerg Meier <joergmmeier@arcor.de> - 2013-04-08 17:04 +0200
    Re: Inserting Multiple Lines from Console Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-04-08 14:10 -0700
      Re: Inserting Multiple Lines from Console Lew <lewbloch@gmail.com> - 2013-04-08 15:10 -0700
        Re: Inserting Multiple Lines from Console x@x.com (znôrt) - 2013-04-09 01:08 +0200
          Re: Inserting Multiple Lines from Console Lew <lewbloch@gmail.com> - 2013-04-08 17:59 -0700
            Re: Inserting Multiple Lines from Console x@x.com (znôrt) - 2013-04-09 08:46 +0200
            Re: Inserting Multiple Lines from Console Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-04-09 05:39 -0300
              Re: Inserting Multiple Lines from Console Martin Gregorie <martin@address-in-sig.invalid> - 2013-04-09 23:04 +0000
              Re: Inserting Multiple Lines from Console x@x.com (znôrt) - 2013-04-10 19:45 +0200
                Re: Inserting Multiple Lines from Console Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-04-10 14:43 -0400
                Re: Inserting Multiple Lines from Console Gene Wirchenko <genew@telus.net> - 2013-04-11 11:11 -0700
                Re: Inserting Multiple Lines from Console Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-04-11 15:05 -0400
  Re: Inserting Multiple Lines from Console lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-04-08 16:21 +0100
  Re: Inserting Multiple Lines from Console markspace <markspace@nospam.nospam> - 2013-04-08 09:56 -0700
  Re: Inserting Multiple Lines from Console lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-04-09 08:28 +0100

csiph-web