Freigeben über


Services and CRUD

If a service provides you with CRUD you can directly manipulate fields of entities or entity-views. This is as straight forward as possible, but why isn’t it always the best thing to do?

Here is an analogy:

The argument against CRUD is very similar to the one against functional programming using C structs versus object oriented programming using classes. The latter allows you to encapsulate the data and gives you the ability to manipulate it using methods where structs don’t offer you a support to do so. Again, even in these days we had to cope with concurrency issues: Multithreading. And again, it is much easier to protect fields on a class by accessing them using thread safe methods compared to the coordination effort required to achieve the same thing for structs.

I know the concurrency issues for services are different from the example above but in both cases it could lead into unpredictable behavior. If services are offering CRUD you might just run into the very same result: unpredictable behavior.

Maarten Mullender is going to write an article about CRUD and all its implications for a SOA. Stay tuned…