Re: The wisdom of the object mentors (Was: Searching OO Associations with RDBMS Persistence Models)
Date: 2 Jun 2006 09:07:17 -0700
Robert Martin wrote:
> It's called decoupling. Generally it's based on dynamic polymorphism
> which is a lot of syllables that really mean function pointers. The
> idea is that you write the application program in such a way that it
> can manipulate the data in the data model without coupling it directly
> to the DBMS, or the details of the schema.
This makes no sense to me - how do you manipulate data without knowing the details of the schema? Is it that valuable to have in all cases a "mapping layer" with some intermediate form used to moderate?
I understand the value of a mapping layer when one is forced to interface with applications that have different expectations of data format. But what you write above seems to imply that an order entry system (e.g.) should have no knowledge of, for example, the fact that an order has line items.
> The decoupling mechanism is
> very similar to the mechanism used to create device independence in
> operating systems like Unix.
I don't think they're at all similar. The interfaces to different devices are clearly defined; even if you have a "Unixy" stream, that stream is interpreted in specific ways depending on the device type.
I can understand isolating the code which issues the command to the DBMS. But to have no knowledge of the schema? To isolate knowledge of whether you're dealing with XML "data structures", or something generic but language-specific, or relations / recordsets / etc? Silly. The number of times I've actually seen a need for that isolation, in my 17 years' experience, is one.