CRUD
The acronym CRUD [ kɹʌd ] encompasses the four basic operations of persistent storage
- C reate ,createdata record,
- R ead or Retrieve , read data record,
- U pdate , update record, and
- D elete or D estroy , delete data record.
Some authors use the acronym RUDI ( insert instead of create ) or CDUR (based on the key of C major ).
CRUD language constructs
CRUD operations can be expressed in different language constructs depending on the environment:
CRUD operation | SQL -92 | HTTP ( REST ) |
---|---|---|
Create | INSERT |
PUT or POST
|
Read (retrieve) | SELECT |
GET
|
Update | UPDATE |
PATCH or PUT
|
Delete (Destroy) | DELETE |
DELETE
|
CRUD frameworks
In many cases, the individual CRUD operations are implemented using a persistence layer. The persistence layer raises the relational representation of the individual information to an object-oriented level. If the individual data objects are also visualized in a generic GUI so that each object can be manipulated using one of the CRUD operations mentioned, then one speaks in this context of a CRUD framework . The following illustration is taken from the naked objects documentation and shows the possible structure of such a CRUD framework.
The graphical user interface of a CRUD framework is often a simple HTML interface. The CRUD framework typically takes individual transaction steps into account . As a result, data is only saved if the Save or Next button has been pressed within the HTML interface . If this is the case, the update operation is ultimately carried out.
The CRUD framework of course exhibits equivalent behavior for the remaining CRUD operations. A CRUD operation is therefore an atomic process .
Atomic operations are of interest in this context, since modern software applications are often implemented as multi-user systems. A CRUD framework allows a data record to be read and written even if the two operations take place at a very different time. Nevertheless, other people are allowed to read out the same data set during this time. As a result, the record was not locked.
Examples
Here are some examples of CRUD implementations, broken down by language or platform :
- JDBC
- JBoss Seam
- Naked Objects for Java
- Catalyst
- Gantry