Re: [xsl] How to never make mistakes when coding?

Subject: Re: [xsl] How to never make mistakes when coding?
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 1 Mar 2025 18:44:31 -0000
> How to avoid making mistakes? Is it even possible?

It depends on the definition of "mistake" ...

If "mistake" means any case where one's expectations contradict reality,
then again we have the same problem, because now we need to define
"reality"...

And probably, regardless of how we define "reality", reality is not
constant and is undergoing changes, the rules for which are probably part
of a "higher reality", ..., and so on.

Not so theoretically, our learning process is essentially recognizing an
error (a mismatch with reality), solving the problem of not committing
this error again, and repeating this over and over again, iteratively.

So, if one doesn't commit mistakes, this person is not learning and not
progressing - probably they are already "dead".

We must welcome new errors whose analysis and correction makes us wiser.

We do have a problem when we do not learn from errors and repeat them again
and again all the time. And of course, the worst errors are the ones that
we don't see at all.

To return to the highlighted question above:

To avoid situations in which you might make mistakes may be the
biggest mistake of all (
https://www.brainyquote.com/quotes/peter_mcwilliams_385687)

And another one in Bulgarian: "PQP5P:P0P;P5P= QP2P5QP5Q P8 P1P>P3Q P=P5
P5 P4QP0P3." My
translation: Even God doesn't like a perfectionist-saint. It would be good
to know what corresponding proverb(s) exists in English :)

Thanks,
Dimitre.

On Sat, Mar 1, 2025 at 6:49b/AM Roger L Costello costello@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi Folks,
>
> A few days ago I found a mistake in my code. The input data to my code
> contained a sequence of records and my code should iterate over all the
> records after the first record. I wrote this:
>
> <xsl:for-each select="/root/record[position() gt 2">
>
> See the mistake?
>
> I should have written position() ge 2 or position() gt 1
>
> That mistake had been in my code for weeks. It was only a few days ago
> that I accidentally discovered it.
>
> "How could I have made such a simple, basic mistake? Was it a lapse in
> attention? I asked myself.
>
> How to avoid making mistakes? Is it even possible?
>
> One part of me thinks, "You are human. Humans make mistakes. It's part of
> our psychological makeup. Accept that you will always make mistakes. The
> remedy for mistakes is to find good ways--testing, validation--to identify
> the mistakes and then fix them."
>
> I don't like that. I'm an optimist--if there's a problem, then there's a
> solution.
>
>  Perhaps if I had extreme discipline, then I could have mistake-free
> code?  Perhaps if I had no mental lapses when coding, then I could have
> mistake-free code? Perhaps if I adhered rigorously to some programming
> practice (e.g., literate programming), then I could have mistake-free code?
>
> Perhaps if I had a tool that generates code, then I could have
> mistake-free code?
>
> Perhaps code that is rooted in algorithms--do step 1, then step 2, then
> step3, etc.--will always lead to code with mistakes? Perhaps the
> declarative approach--state what is, not how to do it--is the path to
> mistake-free code?
>
> Have you thought about these types of questions? What answers did you come
> up with?
>
> /Roger

Current Thread