2

Why is it

  • Create
  • Read
  • Update
  • Delete

instead of

  • Get
  • Remove
  • Add
  • Set

?

I've been working with an API that uses ADD and SET and REMOVE. Most accessor functions are named get...() and set...(). I couldn't find anything online https://duckduckgo.com/?q=gras+crud&ia=web

closed as primarily opinion-based by gnat, Erik Eidt, JeffO, Eric King, Andy Sep 10 '16 at 12:25

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
  • 7
    Why does it matter? – Philip Kendall Sep 9 '16 at 18:38
  • see Difference between REST and CRUD – gnat Sep 9 '16 at 18:51
  • 1
    Side topic: I've found the two sets of verbs useful at different levels of abstraction. For example (and assuming I'm not using an ORM), functions named CreateThingy() or UpdateThingy() would be used in a persistence-level layer, whereas AddGizmo() or ModifyGizmo() (a.k.a., SetGizmo() in your case) would be the API at the business logic layer. – yukondude Sep 9 '16 at 19:25
6

Because the world of programming is much, much older than both HTTP and REST.

The term [CRUD] was likely first popularized by James Martin in his 1983 book "Managing the Data-base Environment".

Whereas

Development of HTTP was initiated by Tim Berners-Lee at CERN in 1989.

and

The term representational state transfer [REST] was introduced and defined in 2000 by Roy Fielding in his doctoral dissertation at UC Irvine.

Besides, each letter in the acronym can map to a standard SQL statement but not so much HTTP methods:

The comparison of the database oriented CRUD operations to HTTP methods has some flaws. Strictly speaking, both PUT and POST can create resources; the key difference is that POST leaves it for the server to decide at what URI to make the new resource available, whilst PUT dictates what URI to use; URIs are of course a concept that doesn't really line up with CRUD. The significant point about PUT is that it will replace whatever resource the URI was previously referring to with a brand new version, hence the PUT method being listed for Update as well. PUT is a 'replace' operation, which one could argue is not 'update'.

Finally the CRUD acronym's create, remove, update and delete operations can be implemented in many kinds of persistence layers, like object database, an XML database, flat text files, custom file formats, tape, or card, etc., which makes this acronym more universal.

Source: Wikipedia's article's on CRUD, REST and HTTP.

  • 1
    Wow 1983 even predates JavaBeans. – Chloe Sep 9 '16 at 19:23
4

Tulains addressed CRUD, allow me to focus on your suggested Get, Remove, Add, Set, which is a bit of a hotchpotch.

Get and Set are 3rd generation language prefixes by convention for functions that either return or change a value. When OO emerged, they became common for properties (getters and setters, also once referred to as selectors and modifiers).

Add and Remove are quite different from Create and Delete. They imply the object already exists (before the Add) or will continue to exist (after the Remove), whereas Create/Delete gives birth to an object and kills it respectively. Add/Remove is typically used for changing an object's membership of a collection.

Not the answer you're looking for? Browse other questions tagged or ask your own question.