Can I borrow your eyes for debuging (Vector inside Vector)?

R

Roedy Green

No thanks. I've already wasted enough time following your "mindprod"
links. Not that they're all bad, but using them to answer usenet posts
all the time is annoying, like someone who insists on posting in HTML.

By that you could mean:

1. you wasted your time because you followed the link with a question
in mind and the material at the link did not answer your question. If
you mean that, please email me with the question an entry did not
answer and I will do something about it. I do this many times a day
for other people.

2. you wasted time because of the time it takes to put the link in
your browser and download the entry. I suggested in another response
you try the local Replicator mirror for faster response. see
http://mindprod.com/jgloss/replicator.html

Links are terse. HTML is unreadable bulk for most newsreaders. I
don't see why you consider them analogous other than you don't like
them both.

Are you seriously suggesting I should post the CONTENTS of every
glossary entry every time I now post a link? Surely the screams
would be ten times louder. You don't post something that has been
posted before. That is spam.

What I am doing is a slightly more polite version of "reading the
fucking faq". I provide a link to the page they need to read. I used
to just give the keyword until people complained.

It is just my links that bug you, or links in general?

Perhaps it bugs you that I have an canned answer to so many questions
on tap. I have been doing this for ten years now. It just adds up.
Except for questions about specific third party packages there is not
that much new in Java itself each day.

I am here primarily to help fledgling programmers in the third world.
They often cannot afford text books. They have to make do with my
glossary entries and the online docs they point to.
 
J

Jean-Baptiste Nizet

I agree with Roedy here. Besides being not "standard", it also puts the
index variable in the outer scope, instead of tying it inside the loop
scope. This is bad practice.

JB.
 
R

Roedy Green

I agree with Roedy here. Besides being not "standard", it also puts the
index variable in the outer scope, instead of tying it inside the loop
scope. This is bad practice.

You can't use the while count idiom twice in a row since you can't
redeclare the index variable in the same scope.

There is also the general rule that it is best to narrow the scope of
a variable to the absolute minimum. Making it overly broad just
creates opportunities for unintended interactions, or other uses being
overlooked in maintenance. And for those not afraid of Knuth, it
suppresses various optimisations, such as putting an indexing value
purely in a register.
 
R

RC

Thank Q to Roedy's hint below.
I compiled my program without errors, now.
You can rest your eyes for now untill next
time I need to borrow again.
 
M

Monique Y. Mudama

["Followup-To:" header set to comp.lang.java.help.] On 2005-09-28,
Roedy Green penned:
That is illogical. It takes about the same bandwidth to get
material from my site as from a newsgroup. My way cuts down your
total bandwidth since you don't have to look at what is not a
pressing concern to you. You can just mentally file it away for
future reference or ignore it.

I assumed he meant the number of link-only posts, not the length of
the posts. If he has his client set to only d/l a message when he
views it, then it may seem annoying to go to that trouble just to see
a link you've already seen many times before.
 
J

Jeff Schwab

Roedy said:
What I mean is you must write code in a stereotypical way. You want to
"blend" . You write code the way everyone else does. Coding is not
novel-writing. People don't want to linger over your code and enjoy
the nuance. They want to be able to rapidly eyeball it and grasp the
meaning quickly.

Where do you get off telling me what I want?
If you avoid the common idioms you slow people down.

I prefer "while" to "for." By using a for-loop aren't you avoiding the
simpler and even more canonical while-loop?
Most coding is not a solitary activity. You have to get along with
fellow team members which means everyone coding in a similar style.
Wherever you work the standards imposed will be slightly different.
The exact rules are much less important than the fact everyone agrees
to follow them. Ditto code indentation and spacing.

Thanks for the lecture.
Further, even if you code alone, still likely others will eventually
see your code. You should not get into idiosyncratic habits.

Like using while-loops?
All you do is make it harder for others to understand your code.

It is not a matter of your way vs my way. It is a matter of following
conventions vs you playing artiste.

"Playing artiste?" You think I'm dancing around the computer with a
beret tilted jauntily on my head, and a rose clenched between my teeth?
I know being conventional feels sinful, especially to the young, but

I would love to know how old you imagine I am. :)
there are times when it is appropriate. Think of it as form of
consideration for others rather than a damper on your creativity. If
you want to be creative, express it elsewhere than making pointless
variations on common idioms.

As much as I would like to take credit for bing creative, I did not
invent the while-loop.
I am not going to leave this alone. I have been coding myself 42
years. I have made those exact same mistakes and had people trip over
my fancy-pants code. I know how being coerced rankles, but writing in
a standard way really does matter.

I have yet to see a standard that required me to use a particular kind
of loop, though I certainly *have* seen standards that avoided do-while
loops and other language features perceived as being unnecessary or
redundant.
Look at Sun's code. You will not see any of their programmers avoiding
common idioms.

You would have if you had looked during the four years I worked there.
That is part of what design patterns is all about,
making code more boring.

Design Patterns are a fascinating field of study, but they're really not
related to what we're discussing. We're talking about a built-in
feature of many popular programming languages. Aren't we?
 
S

Stefan Schulz

You can't use the while count idiom twice in a row since you can't
redeclare the index variable in the same scope.

You should not do that anyway, since an inner loop iterating with the same
variable will invariable cause confusion to the reader.
There is also the general rule that it is best to narrow the scope of
a variable to the absolute minimum. Making it overly broad just
creates opportunities for unintended interactions, or other uses being
overlooked in maintenance. And for those not afraid of Knuth, it
suppresses various optimisations, such as putting an indexing value
purely in a register.

Any compiler worth its salt will recognize the life of the variable ends
with the block, and starts with its initialization. Instruction reordering
previous to register allocation will likely produce the exact same code,
(which the register allocator then maps to registers as it sees fit in its
infinite wisdom ;) )
 
R

Roedy Green

Any compiler worth its salt will recognize the life of the variable ends
with the block, and starts with its initialization. Instruction reordering
previous to register allocation will likely produce the exact same code,
(which the register allocator then maps to registers as it sees fit in its
infinite wisdom ;) )

Early my career I worked on number crunching programs for the local
electric utility that took many hours to compete. The game was looking
for yet another way to speed them up. I would look at the assembler
generated by IBM's Fortran H and PL/1 compilers to see what sort of
optimisations they would make. So often they would miss "obvious"
ones. Then you have to imagine being the compiler without the extra
knowledge you have about what pathological things could happen, and
allow yourself to get paranoid. Then you discover the most innocent
little things could inhibit an optimisation.

Java is nicely designed from an optimising compiler's point of view,
but still I think that general observation would still apply. If you
can keep code simple and non-intertwined, the optimising compiler will
be able to do more with it.

But even more important, keeping variables as local as possible is a
great boon to the maintenance programmer. It allows him to IGNORE
hunks of code.
 
R

Roedy Green

No thanks. I've already wasted enough time following your "mindprod"
links. Not that they're all bad, but using them to answer usenet posts
all the time is annoying, like someone who insists on posting in HTML.

If you like, we could mutually filter each other. Then you will never
see any of my link answers, and I will never see any of your eccentric
Java code.
 
R

Roedy Green

Are you serious, or are you being deliberately insulting?
What is insulting about being 17? I would give my eye teeth to be 17
again. Mathematicians do their best work in their teens and early
twenties.

You have such a strong distaste for convention I figured it could be
general teen rebellion or inexperience with the consequences. That is
roughly how I felt at 17.
 
J

Jeff Schwab

Roedy said:
What is insulting about being 17? I would give my eye teeth to be 17
again. Mathematicians do their best work in their teens and early
twenties.

You have such a strong distaste for convention I figured it could be
general teen rebellion or inexperience with the consequences. That is
roughly how I felt at 17.

I don't have any distaste for convention. I just find multiple
statements on a single line of code distasteful, even in a for loop.
Don't read anything into it.

If people were not dissatisfied with the existing state of the art,
there would be no progress. Wild whippersnappers, flouting convention
by restricting their code to their preferred subset of language features
, may be preferable to gurus exploiting features even they don't really
understand.

I may not have as much industry experience as yourself; forty-two years,
did you say? Far fewer for me, but the same number of digits, and I
know what a Hollerith card is. And I, for one, would not want to be 17
again: no college degree, no salary, and no wife.
 
J

Jeff Schwab

Roedy said:
If you like, we could mutually filter each other. Then you will never
see any of my link answers, and I will never see any of your eccentric
Java code.

I thought about it, but you post on a lot of threads, and seem to help
people frequently. I think if I plonked you, I would be missing a
significant part of the dialogue here. If you're really irked by
"eccentric" posts that don't include for-loops, you're probably better
off ignoring me entirely. :) Here's one for the road:

import java.io.PrintWriter;

public class For {
public static void main(String[] args) {
PrintWriter out = new PrintWriter(System.out);

for(;;) {
out.println("Goodbye, cruel world!");
}
}
}
 
M

Monique Y. Mudama

["Followup-To:" header set to comp.lang.java.help.] On 2005-09-29,
Roedy Green penned:
What is insulting about being 17? I would give my eye teeth to be
17 again. Mathematicians do their best work in their teens and
early twenties.

You have such a strong distaste for convention I figured it could be
general teen rebellion or inexperience with the consequences. That
is roughly how I felt at 17.

I read it more as "No one can tell me what to do! I've been there and
done that and gotten the teeshirt!" -- definitely a mentality I
associate with older people, and more specifically my dad =P
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top