Re: what is the initial value of arrays of object
- From: Lew <noone@xxxxxxxxxxxxx>
- Date: Thu, 16 Oct 2008 11:43:49 -0400
Andreas Leitgeb wrote:
Lew <noone@xxxxxxxxxxxxx> wrote:The language features are the language features. They do what they do. ...
... They're not to be liked or disliked but used (or not used) as you
will.
Ok, lets see a few "features" of Java:
- capital I and lowercase l are different identifiers
In all programming languages, typographic similarities between identifiers exist in certain fonts, and single-letter variable names are discouraged in most of them. There are times when they make sense.
- the Vector class (legacy, but still there, and even
facelifted(made generic) for 1.5), ditto Enumerator
That's a feature of the API, not the language.
- postfix "long"-literals with a lowercase "l"
Again, typographic similarities are not a feature of the language but of the font used to express its source. If you used a different font, you wouldn't worry about that. The fault is not with Java here, but with the font.
- changes in indentation "without reason". Unlike Python, Java does allow that.
Unlike Python, if I understand what you're saying about Python, you have the freedom to use indentation to augment readability without fear of polluting the semantics of your code. That's a good thing. Why do you list it as a bad thing?
Ok, you wouldn't use these "features" yourself, but see
I most certainly would use the feature (no quote marks) of semantic-free indentation.
yourself as having to work together with people who do
use them. Would you silently accept it ?
I don't have a problem with initializer blocks nor statement blocks.
Probably not. You'd try to explain to them the disadvantages
and convince them of alternatives, the same way you do it with
people showing samples of their code here in this newsgroup
and asking questions that aren't even related to these "features".
Again, putting "feature" in quotes like that is not evidence.
Initializer and statement blocks are a feature of the language. I do not discourage their use - I encourage their appropriate use. There are times when they enhance readability or program semantics. Like other features, I do not recommend their indiscriminate use.
For example, statement blocks give a convenient way to limit the scope of a temporary variable.
But just like 42l could be mistaken for 421, a statement-block
asks for a look to the preceding context, looking for some statement
that goes with that block, just to see *if there is* one (btw., just
the same way as a sudden change of indentation-depth would).
The confusion of "l" for "1" is typographically inherent. The confusion of statement blocks with ones that have, say, a condition is not. Unlike typographic confusion, confusion over statement blocks is in the insufficiently-trained mind of the programmer.
Certainly as a code reviewer or maintainer you must be familiar
with these tools.
Yes, for sure, and as such it is almost one's duty to recognize and discourage the use of such "features".
Again with the quotes. It is my duty to encourage the use of statement and initializer blocks.
PS: Yes, I find standalone braced blocks just as bad as all the
other samples I gave, except for the Vector class, which I find all ok, myself, but of which I know that you dislike it.
I disagree with you about brace blocks and indentation. Vector is not a Java feature, and typographic confusion is not a training issue, whereas brace block confusion is. It is relatively hard to fix the font on your screen. It is relatively easy to fix ignorance.
--
Lew
.
- Follow-Ups:
- Re: what is the initial value of arrays of object
- From: Andreas Leitgeb
- Re: what is the initial value of arrays of object
- References:
- Re: what is the initial value of arrays of object
- From: Arne Vajhøj
- Re: what is the initial value of arrays of object
- From: Andreas Leitgeb
- Re: what is the initial value of arrays of object
- From: Lew
- Re: what is the initial value of arrays of object
- From: Andreas Leitgeb
- Re: what is the initial value of arrays of object
- From: Lew
- Re: what is the initial value of arrays of object
- From: Andreas Leitgeb
- Re: what is the initial value of arrays of object
- From: Lew
- Re: what is the initial value of arrays of object
- From: Andreas Leitgeb
- Re: what is the initial value of arrays of object
- Prev by Date: Re: 'static' overloaded?
- Next by Date: Re: Hi
- Previous by thread: Re: what is the initial value of arrays of object
- Next by thread: Re: what is the initial value of arrays of object
- Index(es):
Relevant Pages
|