10-mutate.com
mutate
To change or alter something. A person might say they want to mutate a plan, meaning they want to revise or update it.
What a model may hear
- modify in place programming, especially JavaScript and state management
- assume the user wants to change an existing data structure directly rather than create a new one
- GraphQL mutation GraphQL API design
- interpret the request as a write operation to create, update, or delete server data
- genetic mutation biology, bioinformatics
- treat the context as involving DNA, genes, or evolutionary algorithms
- database mutation distributed systems and databases
- assume the user is referring to a logged change event or a write to a replicated store
Where people and models part ways
“mutate the list”
Meant: change what items are in the list
May be taken as: assume the user wants to modify the array in place with push/pop rather than return a new array
Say instead: “return a new list with the changes, do not modify the original”
“mutate the document”
Meant: edit the file
May be taken as: assume a MongoDB update operation or a GraphQL mutation schema
Say instead: “edit and save the file, not a database record”
“mutate the design”
Meant: try a different version
May be taken as: invoke a genetic algorithm or evolutionary optimization process
Say instead: “create a variation of the design”
Tips
- Say 'return a new copy' if you do not want in-place modification.
- Specify 'GraphQL mutation' explicitly if that is what you mean.
- Use 'edit' or 'change' instead of 'mutate' when talking about documents or files.
- Say 'evolve' or 'breed' for genetic algorithm contexts to avoid confusion.
- Add 'without side effects' if you want functional-style immutable behavior.
Often confused with
- modify
- neutral, does not imply in-place vs. copy
- update
- often implies a database or persistent store write
- transform
- usually implies a new result, not changing the original
- evolve
- suggests gradual or generational change, often biological
- alter
- general synonym, less technical baggage
- setState
- React-specific, may or may not mutate depending on version