Subject: Re: [xsl] How to never make mistakes when coding? From: "Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sat, 1 Mar 2025 19:11:53 -0000 |
Hi Roger, I like mechanisms that let me efficiently capture and validate my assumptions while coding bin the momentb, such as type annotations and assertions. These capture more coding errors than I would like to admit. * Chris From: Dimitre Novatchev dnovatchev@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Sent: Saturday, March 1, 2025 1:45 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] How to never make mistakes when coding? > 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<https://urldefens e.com/v3/__https:/www.brainyquote.com/quotes/peter_mcwilliams_385687__;!!A4F2 R9G_pg!fhTQjGW-cBmoGI-axD9rI9ZEcRmhJdIL6IcDAAlIyfmHwI55qVr8x_xZyEJiimifufNPam cch9-vKRf9zuuQDBFR4Z1bPpnuB8zNgRn35nY4lFLKlZvI$>) 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<mailto:costello@xxxxxxxxx> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx rytech.com>> 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 XSL-List info and archive<https://urldefense.com/v3/__http:/www.mulberrytech.com/xsl/xsl-list__ ;!!A4F2R9G_pg!fhTQjGW-cBmoGI-axD9rI9ZEcRmhJdIL6IcDAAlIyfmHwI55qVr8x_xZyEJiimi fufNPamcch9-vKRf9zuuQDBFR4Z1bPpnuB8zNgRn35nY4lIT-OXz3$> EasyUnsubscribe<https://urldefense.com/v3/__http:/lists.mulberrytech.com/unsu b/xsl-list/3380743__;!!A4F2R9G_pg!fhTQjGW-cBmoGI-axD9rI9ZEcRmhJdIL6IcDAAlIyfm HwI55qVr8x_xZyEJiimifufNPamcch9-vKRf9zuuQDBFR4Z1bPpnuB8zNgRn35nY4lJgTnLJA$> (by email<>)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to never make mistake, Dimitre Novatchev dn | Thread | Re: [xsl] How to never make mistake, Michael Kay michaelk |
Re: [xsl] How to never make mistake, Dimitre Novatchev dn | Date | Re: [xsl] How to never make mistake, Michael Kay michaelk |
Month |