I’m still out on if the database as a service is a good or bad idea. I am leaning towards the latter though.
One of the scary things most developers do today is refactoring the database. I actually think a lot of good refactorings just isn’t done because it becomes a large and daunting task when it comes to databases. Exposing your schema directly to other consumers just makes this worse. An abstraction would help some, at the cost of maintaining the abstraction. I do feel that this abstraction could be functions and/or views, but for most Java developers this is much harder to maintain than a Java abstracion.
Check out this blog for some arguments against database as a service.
2 replies on “Database as a service”
Arnon has some good points. Mainly, he argues that a service that looks like a database is not so good.
Sadly, a large number of the example services that I have used and seen as examples of good services seem to be data-oriented services. If you rather want to use a screw driver than a hammer, you’d better hope your problem isn’t a nail.
You might want to reconsider using views when it’s the right tool for the job. Here is a simplified example from my current application. Take a look at it, even though it is requires non-Java knowledge. How much code will you have to write to get Java to do the same thing?
create materialized view customer_address
refresh start with sysdate next round(sysdate) + 14/24
select
customer.name,
address.*,
decode(
customer.customer_type,
“gurgle”, false,
“buzzle”, true) uses_encryption
from
customer@cust_dblink
inner join customer_group@cust_dblink group on (customer.group_id = group.id)
inner join address@cust_dblink on
(address.id = nvl(customer.address_id, group.address_id))
Yup, something along the lines I was thinking. I think I would probably also include a version number in the view name. That way you have a way to support different but similar views to different clients, and even phase out the older views by only supporting the n last versions, or deprecation dates. It might be a bit design up front, but won’t cost you much.