CRUD operations, by definition are...

interfaces that permit users to create, remove, modify or retrieve data

Implementations of CRUD interfaces can come in various shapes and sometimes they are even extended to SCRUD. What most CRUD interfaces have in common is that they refer to all major functions of e.g. a relational database. A basic implementation may look like this:

class CrudInterface {
    void add(obj entity);
    void get(obj entityKey);
    void update(obj entity);
    void delete(obj entityKey);

But now consider the following additional method on the example interface above:

void add(Collection<obj> entities);

Does such a thing belong on a CRUD interface? Wikipedia says

the software (which offers the CRUD interface) must allow the user to create or add new entries

So the example above seems valid by this definition. However, most relational database technologies don't support such a operation. And if they do, they mostly just loop through the collection and add the objects individually, which can have major drawbacks when a operation is coupled with a condition or a event hook.

So, is the use of collections on CRUD interfaces valid and/or legitimate?

  • 2
    That's a very weak justification. When you say, "people in the protest wore large banners", it almost certainly doesn't mean that anyone carried multiple, large banners. There were probably multiple banners present, but carried by different people. Adding "entries" can likewise be done with successive calls. (That doesn't mean it might not be a good idea of providing collection operations for convenience, just that the use of the plural in the definition doesn't endorse that choice.) Sep 19, 2014 at 8:48
  • @KilianFoth Yes, this is also something that went through my mind. However I was not able to find any more specific definition that might clear things up a bit.
    – xvdiff
    Sep 19, 2014 at 9:23
  • Insert statements can include multiple values: stackoverflow.com/questions/2624713/…
    – JeffO
    Sep 19, 2014 at 14:42

1 Answer 1


It is not true that most relational database technologies only support adding items one at a time. Most major RDBMS have a bulk insert or load command that adds many rows at once. This is much more efficient than calling insert over and over again.

Thus, any CRUD interface that needs to handle loading large volumes of data should have some mechanism for adding multiple rows at once.

  • Don't bulk inserts require pulling the date from disk in the form of some text file or other database table? This doesn't seem practical for a list items someone entered into a grid on a website.
    – JeffO
    Sep 19, 2014 at 14:40
  • 1
    @JeffO - Not necessarily. MS SQL, for example, can perform a bulk insert from a C# datatable. And it's relatively trivial to convert a list of items entered on a website into a datatable to be bulk inserted.
    – user53019
    Sep 19, 2014 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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