views:

40

answers:

2

the CMS our chief coder designed has the update/insert actions handled by one controller. Most of the CMS's I see has separate handlers for update and insert. Why are most CMS's designed this way? Even the REST pattern has separate actions for update and insert (I don't know what they're exactly called though).

A: 

Probably because it's two of the four basic CRUD operations found in user interfaces. It's more intuitive, easier and safer to perform a single "Edit" operation on data than performing a "Remove" operation then an "Add" operation.

In silico
that may be it probably, but are there any functional reasons or advantages for doing so?
Ygam
Yes. Doing a single edit is easier and safer than removing then adding data.
In silico
A: 

Depending on how the data is persisted, an "update" will not change the identity/primary key, while a remove/insert combination could result in a new identity/primary key. If that primary key is referenced elsewhere (say, in a URL), then that reference will no longer work.

mgroves