Roedy said:
After realising that there are issues with arrays syntax, I agree. But
for other similar issues where there are no semantic difference, I still
hold the opinion that its just a preference.
That is illogical. If others disagree with you, then obviously it does
matter even if just to reduce friction. You could only justify your
stance in a vacuum. As soon as you show your code to others, you have
a potential to get their backs up with eccentricities. You then get
into a cost benefit situation. Is the benefit of doing things an
eccentric way worth the hassles when dealing with others.
Usually there are good reasons why the world settles on a consensus,
for example the use of int[] x rather than int x[]. If you pick
conventions just to be different or arbitrarily, you will usually be
missing out on some benefit.
It seems odd to aim to write code as hackneyed as possible, full of as
many trite idioms as possible, but that is what is easiest to
maintain.
Roedy said:
I take it, Tom, that you have never worked on a team. In order to
avoid false deltas, usually a team will have EXTREMELY tight coding
conventions, much stricter than the ones Sun suggests. See
http://mindprod.com/jgloss/codingconventions.html
If you don't follow them, you will soon find yourself on the street.
Now you are just being silly, is this is how far the discussion has
gone, that you have no more constructive arguments and feel you need to
resort to the "descrediting game"?
I have no problem with your point of view or that you express or
discussing the postives and the negatives of it, but please refrain from
trying to impress on me or others your view. Thats not really very
becoming, of anybody.
I recently had a similar discussion with a consultant working with me at
my workplace. He was trying to set a rule that import should be written
with the class name, not with *. Do you know what his reason was? He
claimed it was faster, implying that it was so for the compiler and the
runtime. Now we all know that it is not so, and I corrected him on that.
Do you know what his motivation was? He had this problem that he is a
Sun Java Champion and he is a chief consultant at his company, so in his
mind he needs to be right, ALL THE TIME, sounds familiar? What he did
not say, which he could have, was that since he uses intellij its
automagic and therefore mixing such statements makes the code look ugly
or something Instead he chose to try to force his will on the rest of
the team. It ended up with with me having to tell him where the line is
in the team.
If these things are such issues, it would have been included in any
langauge spec. Its really a non-issue, which most people dont care about
anymore, they want to spend their time where it matters. I am not saying
readability and maintainability are not important, I am saying some
issues are just to tiny to bother with.
You must realise that the world IS a messy place, you can't go around
with a belief that people are this or that just because they don't
follow your rules. Take any given human language, 99% of all native
speakers make grammatical mistakes while speaking or writing. Do you see
many people care about that, no. What you see, once in a while, is some
language professor going crazy about it in some newspaper under the
section readers comments and calling for the entire nation to stop until
it's fixed. That's the way it is with anything in the world, some things
are minor issue, and people can't be bothered to spend any energy on it.
Most projects I have worked on there has been some rules, but they have
little to do with pretty syntax, but rather with semantics and avoiding
bugs. F.ex at my workplace we are making embedded voip software and one
of the rules we have is:
instead of writing
if(some_var==SOME_MAGIC_NUMBER)
do something
we write
if(SOME_MAGIC_NUMBER==some_var)
do something
(with SOME_MAGIC_NUMBER being a C define), do you see why one would
write it like this?
It has to do with reducing the number of bugs in the software, that's
the kind of things they care about. The consensus in projects I have
worked on is that as long as its readable, semantically the same and
reasonably similar you can do what you want. Most people I have met
don't care about the old syntax pissing contest any more.
So, if you could stop trying to force your will on others that would be
nice, if not, it shows lack of basic human respect on your part. I have
no problem with your opinion on the matter, its your perogative and you
can do what you want. But stop the "I am the senior here, you SHOULD do
what I want" game. If you dont have a decent and constructive argument,
then you should not particiapte in the discussion. I will do my best as
well, I know I have much to learn about java and thats where I want to
focus my energy. Agreed?
Have a look at Eclipse or IntelliJ. They goes on for pages and pages
defining in minute detail how to format your code. In a team,
everyone uses the same template.
Eclipse and intellij are for beginning programmers, I write all my code
in emacs or was it vi? hmm... never mind
/tom