Brian's Waste of Time

Wed, 03 Aug 2005

Flattening the Abstractions

The "right way" being promulgated "right now" for a lot of application design is kinda, sorta, maybe over abstract I think.

Let's look at a perenial favorite, talking to a database. We'll go ahead and consider JDBC to be the lowest level API available for chatting with the DB. Place on top of that OJB|Hibernate|IBatis|Cayenne|JDO|TopLink. Now, you had best not depend on the particular o/r library, so you build a DAO abstraction which allows you to change them. Now, DAO's are the gateway between the the "resource tier" and the "middle tier" so you write a service which uses the DAO and mucks with whatever it returns. Maybe you use the service from another service, whatever. Of course eventually you want to let someone see this data, so you write a service facade to expose to the "view tier." If you are old school you map to a DTO layer for crossing the middle/view barrier, if you are new school you hope your query back whenever ago fetched everything whatever on the other side needs, because you are not allowed to know, after all.

0 writebacks [/src/java] permanent link