The database as a service anti pattern

time to read 2 min | 210 words

A while ago I stated:

The problem is supporting change tracking in disconnected scenarios. In particular, you take an object from the database and send it to the presentation layer, some time later, you get the object from the presentation layer and persist it to the database again. There is a whole host of bad practices and really bad design decisions that are implicit in the problem statement, but we will leave that alone for now.

I was asked what I meant by that. I think that just the title of this post should suffice as an answer, but I believe that I can let Arnon answer this best:

So why is exposing the database through a web-service (RESTful or otherwise) is wrong? let me count the ways

  • It circumvents the whole idea about "Services" - there's no business logic
  • It makes for CRUD resources/services
  • It is exposing internal database structure or data rather than a thought-out contract
  • It encourages bypassing real services and going straight to their data
  • It creates a blob service (the data source)
  • It encourages minuscule demi-serices (the multiple "interfaces" of said blob) that disregard few of the fallacies of distributed computing
  • It is just client-server in sheep's clothing