Re: The wisdom of the object mentors (Was: Searching OO Associations with RDBMS Persistence Models)
Date: 20 Jun 2006 13:44:01 -0700
Robert Martin wrote:
> > And to address your point even more directly, a relational calculus IS
> > simpler than a "bucket of bits." Presumably, you believe that objects
> > are simpler (for us, the users!) than direct memory addresses and the
> > typeless values stored therein?
> Yes, I quite agree. I also think that abstraction is a very powerful
> tool. So I think I benefit from simplicity if I can relegate all that
> relational calculus to one part of the program and allow the other
> parts of the program to treat the DB as a bucket of bits.
I don't think that's abstraction, at least not the only form of it that's worth discussing. It's encapsulation, to be sure, but we typically encapsulate a service or language to hide it to enable "swapping" later on. That "flexibility" isn't universally valuable, in my (admittedly less than yours) 18 years of professional experience, and design patterns like Interpreter (and any DSL) goes in the opposite direction: exposing service details to the user, in order to save time and cost. Witness any Java system with embedded JScheme or Jython or what have you; those are meaningful UN-encapsulations.
I put relational in the same boat (although it's crippling that relations are not first-class language citizens in such statically hobbled languages as Java). But in my view, the "encapsulating" language limits the utility of the more-powerful (if more restricted) embedded model and language.
I liken the whole thing to writing a system in COBOL, or FORTRAN, and embedding a Java interpreter that allows domain programmers to embed snippets of Java code (or Ruby, or Scheme, or what have you). Presumably you'd agree that what you're embedding is more powerful than the embedding language, and that you'd probably need some specific reasons for not using the higher-level language to begin with. I'd suspect the developers would get extremely annoyed at being the shoemaker's children - again, if there weren't some compelling reason.
An imperfect analogy, but...