开发者

Why is There A Need to Separate "Edit"(update) and "Add"(insert) actions in most CMS?

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? Ev开发者_如何学JAVAen the REST pattern has separate actions for update and insert (I don't know what they're exactly called though).


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜