Mike Schilling wrote:
I think, though I'm not going to insist upon this (not being in a
position to do so, even were I so inclined to; Usenet, as a free
medium, somewhat paradoxically places fewer demands on the reader than
a paid one does. Having no money invested in the reading of a post
leaves the reader free to quit it at a moment's notice for any reason
at all with no sense of having lost any investment. This places a
substantial burden on an author who desires a wide audience to avoid
being either dull or unpleasant. and certainly to avoid unreasonable
demands), that Patricia, whose general good sense is, I should think,
well established in these parts, at least to the extent that a history
of posts can be said to establish a picture of their author (this
being another subject which is open to debate: certainly, the amount
of time that, for instance, sarcasm goes undetected, argues that
Usenet posts are a very imperfect vehicle for communicating the sort
of subtleties by which people, in the common world of face-to-face
communication, use to form opinions of their fellows), has the right
of it here; that while the grammars that underlie both natural
languages like English and artificial languages like Java are capable
of forming expression and statements (and here we are lucky that both
terms, while not synonymous in the two realms, in this case can be
used as if they were) of arbitrarily high complexity, simply by
applying the generation rules repeatedly, that in both cases the
idioms which are understood easily and naturally come from a
constrained application of those rules, and that using examples lying
outside the standard idioms places upon our readers, whose ready
understanding is in fact in our own interests as well as in theirs, an
unnecessary burden, and thus should be avoided or at least severely
minimized, absent any significant advantage to be found in their use.
Pure brilliance. Bravo!
As I stated before, I, at least, have acknowledged the validity of
Patricia's argument in favor of clarity over cleverness.
To a point. I doubt very much that I will be afraid to use anonymous
classes; they are occasionally a necessary idiom. In some rare cases,
although it has yet to be necessary for any program I've worked on, I
can imagine needing to define an anonymous class constructor.
I am not arguing for obscurity for obscurity's sake, nor for cleverness
for cleverness's sake. It's just that in Java the anonymous class idiom
is the heart of certain closure-like expressions. If an anonymous class
is the cleanest way to accomplish such a pseudo-closure, I am going to
use it, and I will expect competent Java programmers to understand it.
If I were hiring a Java programmer, I would test them on their ability
to understand anonymous classes as part of the screening process.
OTOH, I have read at least one assertion that nested classes represent a
security hole in Java code. I am skeptical of that claim, but it's out
there.
something.
simpler and clearer to me.
Code should be as simple as possible, but no simpler.