What is CRUD?

May 2, 2021

CRUD is an essential acronym that models the life cycle of the objects in an application. Since these phases cover most of the application features, it is valuable to grasp the idea behind CRUD.

There are four main actions that form CRUD:

  • Creating an object
  • Reading an object or a set of objects
  • Updating an object
  • Deleting an object

In this guide, we will go over some sample pages and explore CRUD operations they perform.

Create

Almost all applications have object creation features like post sharing, task create and sign-up.

Even though the resulting objects have different types (for example, Tweet, Task and Account), the concept is the same; objects are created with respect to the user input and stored in the database for future use.

Create tweet

Read

Since read operations don't require any user input, it might be harder to identify them. Read actions are commonly used in two patterns:

  1. Reading a single instance, which retrieves details of a single object (for example, tweet-detail, task-detail and account-detail)
  2. Reading a set of instances, which lists multiple instances (for example, tweet-list, task-list and account-list)

Read a single tweet

Read a set of tweets

Update

Update operation works on existing instances to change one or more fields.

Since Twitter doesn't allow editing Tweet instances, we will use profile editing to demonstrate the update method.

As we can see from the screenshot, an update operation can take files (for example, profile image and profile banner) or plain text inputs (for example, name and bio) to modify existing objects.

Update profile

Delete

Deletion is the last phase of an object's life cycle.

Services might remove instances completely, mark them as deleted or move them to trash. As a result, deleted instances are expected to be hidden from the users.

Delete tweet

Summary

Even though application pages, screens and features might vary drastically for each project, the principles behind CRUD operations are the same.

Please follow @crudfulcom and join Discord server for more!