Re: Maintain list of attached event handlers (.Net 1.1)



"Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx> schrieb
On Wed, 11 Jul 2007 16:24:54 -0700, Armin Zingler
<az.nospam@xxxxxxxxxx> wrote:

> [...]
> Let me put it this way:
> A basic programming rule that I (and not only I) always obey is:
> Clean up references as soon as I don't need them anymore.

Fine. Remove them then. It doesn't matter. I have said this
several times. I do not know why you insist on dwelling on the
issue.

I'm dwelling on it because you are again saying "it doesn't matter".
Completely wrong. It does matter a lot because it is the precondition for
the whole discussion.


> As, in this case, I don't care whether it takes 1/100 or 1/1,000
> of a second, how can it be a performance issue? Again, /you/
> mentioned "performance" first.

I don't understand what the concern of "superfluous things" is if
not as regards to performance. However, fine...I'll take as granted
that this is a question of aesthetics and not performance.

Glad to read this, though I'd call it logic not aesthetics.

Your
argument still fails:

> The result of your misinterpretation of why I don't
> want to do superfluous things. It's not for performance reasons.
> It's just
> illogical to do something that does not have to be done.

But it _does_ have to be done.

Yes, but not twice. It /has/ already been done. The code has alrady been
written in order to do it /before/. You are ingoring the preconditions. I
explained why they are how they are. If you like to discuss under
different preconditions, do it with whomever because it won't help
/me/. A answer to a question that I did not ask, doesn't help.

The alternative to is to do
something else that otherwise does not have to be done.

You are arguing in favor of a more complicated implementation, so
that you can avoid something that in theory doesn't have to be done.

Correct. Only "theory" must be replaced by "practice".

But the only scenario in which it doesn't have to be done is the
one in which you complicate the implementation.

The complicated implementation "does not have to be done" any more
than removing non-existent handlers "does not have to be done". So,
how is it that you feel aesthetically it makes more sense to choose
doing the thing that doesn't have to be done that is more
complicated, than to choose the thing that doesn't have to be done
that is simpler?

I'm afraid, I don't understand this sentence.


The whole situation can be expressed VB-ish: (no, not executable...)

If immediatelly remove handlers? then 'programmer's decision
immediatelly remove handlers
if do more than necessary? then 'programmer's decision
do more than necessary 'means: detach some handlers a second
'time when closing the form
'(aka illogical)
else
maintain a list of remaining handlers
do only what's necessary 'means: only detach remaining handlers
'when closing the form (aka logical)
end if
else
'...
end if

- You are still trying to write the lower Else part, but the first
If-expression has already been evaluated True. That's the precondition.
The corresponding Else part is completely out of interest. Feel free to
discuss it with somebody else but it's not what I am interested in.

- At the second If, you decide for True because you want to avoid the
"maintain a list..." job, whereas I decide for the else block. I do accept
the additional programming work ("maintain...") in order to "do only what's
necessary", whereas you don't.


Our different decisions at the 2nd "If" are caused by differently weighting
the pros and cons. For me, the True block is almost unacceptable whereas you
accept it. To me it is almost unimportant how much work it takes to avoid an
almost unacceptable situation. The additional reason to choose the Else
block was pure technical interest in whether and how it is possible.
Meanwhile I know that it is not possible the way I was looking for,
nevertheless it is possible. Therefore I do it. If it wasn't possible at
all, I would have to swallow the bitter pill and choose the True block.

So, we won't find an agreement because we have different weightings.


> [...]
> I think, everything is said about it, don't you, too? :-)

If I thought that "everything is said about it", I would stop saying
things. As long as you continue to present illogical arguments, I
will continue to point out the flaws in the logic.

No problem. I will repeat my arguments until you got them and see that
your's are illogical. I thought we are grown up enough to avoid this endless
loop. Obviously you are not. Anyways, I won't have to add anything new.


Armin

.


Loading