1

I used to know of a word that is used to describe the impact (more lack of it) of running a programming script multiple times. To understand this better, let me try to give an example.

Let's say I create a script to drop a table from a database. If the table already exists in the database and I run my script, it will work OK and will drop the table. If, however, I run my script second time, it will fail as the script will not find the table. This can be avoided if I modify my script to drop the table only if it exists. If write my script to do IF-EXISTS-THEN-DROP then I can run it any number of times without an issue. There is a single word that describes this type of script but I can’t remember it now. I would appreciate if any of you can help.

9
  • Welcome! Is it a common word or jargon?
    – user392935
    Aug 28, 2020 at 15:24
  • It is not a jargon @Stockfish
    – AhmedHuq
    Aug 28, 2020 at 15:27
  • Couldn't you just suppress error messages for the command? If so, it would silently fail without causing any adverse effect. Are you considering "an issue" to be something observable? (In another sense, the command has no issue—it succeeds in executing, but then not being able to act on something.) Aug 28, 2020 at 15:29
  • What is the question please? "A word that describes a specific way to write code" or "A single word that describes this type of script." For the first, diligent, for the second, robust. Aug 28, 2020 at 15:29
  • There's the concept of strict or lazy evaluation of expressions / computer code. I think that covers some of what you're talking about. For example, you have an error logging subroutine that always makes a call to open the error log file before actually writing a line to it. But actually, some lower level of code maintains a switch to avoid opening it again if already open. Aug 28, 2020 at 15:34

2 Answers 2

2

I have found the word now. It is Idempotent. Many thanks for all who tried to answer it.

3
  • 1
    This is the correct answer, but it could use some more detail - maybe quote the definition, show an example of how it's used in context.
    – Juhasz
    Aug 28, 2020 at 16:04
  • 1
    Yep, "idempotent" is the proper technical term. Whenever I need to use the word, though, it always takes me an hour or two to remember it.
    – Hot Licks
    Aug 28, 2020 at 17:17
  • 1
    This post on SO Software Engineering goes into more detail. Nov 2, 2023 at 18:12
0

I wonder if you could describe it as Deterministic, i.e "Given the same inputs you always get the same result." But I'm not sure if the initial state of the table counts as an input.

Code that does have a different result depending on how many times you run it would almost certainly be non-deterministic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.