TransWikia.com

Looking for a word that describes a specific way to write code that does not have adverse effect if executed multiple times

English Language & Usage Asked by AhmedHuq on September 27, 2020

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.

2 Answers

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

Answered by AhmedHuq on September 27, 2020

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.

Answered by JeffUK on September 27, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP