TransWikia.com

Word meaning both create and update?

English Language & Usage Asked by undefined on December 25, 2020

I’d like to know if someone has a better word than authored or produced, for both creating and updating something.

Context:
I’m a software developer and I’m trying to think of a clever way to name the function that will initially create an object, and if it’s already created, update it.

10 Answers

"Save" seems perfect for this. As a developer I'd read "SaveRecord" as either inserting or updating the record depending on its preexistence.

Correct answer by nollidge on December 25, 2020

Sometimes set is used in programming to refer to both creating and updating. It can depend on the language - some languages clearly separate the two operations, some do not.

Some languages try to be clear by not using a single verb for this. For example, SQL uses the verb CREATE OR REPLACE to mean exactly what it says (and what you said).

My suggestion is to check with your language and its users, to see what vocabulary is typically used for this in the particular context.

Answered by Drew on December 25, 2020

Since you stated you're dealing with JavaScript, I'll offer 'assign' as a handy verb. In most programming languages, you need to declare an object property before assigning it, but in JavaScript the assignment operator ('=') both updates and creates properties (when they don't exist).

So if you have your generic object here, and you want to create/update properties of that object using a single function call, you're essentially assigning values to the properties of the object. Creation is implied.

 myObject.prototype.assignProperties = (property, value) => this.property = value;

The only activity carried out in the function is 'assign' by the assignment operator. If the property doesn't exist, it is created.

Source: I'm a software engineer working with JavaScript regularly (FireFox OS applications).

Answered by Coty Johnathan Saxman on December 25, 2020

Within the context of development if you are appling some CRUD changes in one operation I usually opt for "sync" or "synchronize" as a method name.

Answered by Steve Whitfield on December 25, 2020

Populate may be appropriate. When you create or update an object, you typically "populate" the object with new property values.

Answered by James Lawruk on December 25, 2020

I am using upinit "word" for this. In DB world, there is upsert (update or insert). Why not to have update or init?

Answered by rnd on December 25, 2020

I believe it was mentioned in a comment, but Store is very applicable.

Moreover, Store matches in character count to Fetch, which, if you're insane like me, is a quality you value in naming conventions.

function store(val: *);

function fetch(key: *);

function erase(key: *); // or purge()

Answered by Dan Lugg on December 25, 2020

In SQL terminology merge term is used for this: https://en.wikipedia.org/wiki/Merge_(SQL)

This is a synonym of upsert (update + insert) which, in my opinion, suits even better, because its meaning is explicit.

Answered by Yan Takushevich on December 25, 2020

Key-Value stores often use put to create/update and get to retrieve.

I'm late to the party but mention it because save (the accepted and popular answer) suggests that the thing being created or updated is persisted as well. That might or might not be the case. Often persisting is within transactions and done with commit. So if you use save to create or update the object it might still not be saved. In fact, usually isn't saved.

Answered by Peter on December 25, 2020

I'm a developer and ran into this exact issue as well. It is upsert but outside of the context of a database.

crupdate makes the most sense, but have not seen it adopted (yet).

Answered by G SB on December 25, 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