3 ms·
However, the whole point of object encapsulation is to provide that independence, right? I think the issue is how that independence of interface is maintained.
by einhverfr 13y ago
However, the whole point of object encapsulation is to provide that independence, right?
I think the issue is how that independence of interface is maintained. In the relational model, the question is one of transparency in internals and set (or more properly bag) operations, while in objects it is defined interfaces and encapsulation.
It seems to me that's the problem, but you can bridge them by creating stable, defined interfaces (updateable views for example).
- joe_the_user 13y ago"However, the whole point of object encapsulation is to provide that independence, right? ...the issue is how that independence of interface is maintained." OK, a different way to put it is that the relational model provide one kind of independence and object orientation provides another. The way that a foreign key column is not OO encapsulated but does reference a different column allows SQL expressions that aren't dependent on which value is the "real" value. "you can bridge them by creating stable, defined interfaces" Yes you can. At any one point in the development of an application, you can pick a mapping and say "no problem", this is true. The problem is that if you develop an application further, have an object return an object instead of a value say, then the problem of how to change you mapping to reflect the development is hard, harder than one would think. It's not the snap that's hard, it's the evolving application that uses OO and relational models that becomes weirdly hard, where the "impedance mismatch" become evident.
- einhverfr 13y ago> The problem is that if you develop an application further, have an object return an object instead of a value say, then the problem of how to change you mapping to reflect the development is hard, harder than one would think. It's not the snap that's hard, it's the evolving application that uses OO and relational models that becomes weirdly hard, where the "impedance mismatch" become evident. I am not so sure that is really the problem though. As I noted, if you do ORM mappings to updateable views, that both simplifies and complicates things. On one hand it means more code to maintain because you have to map physical storage relations to application-facing logical ones. But on the other hand, it solves the problem you are describing quite nicely because your apps only see an intermediate form of the data. You control this intermediate form and it is independent of how the data is stored. The real problem I see with ORM usage generally is that instead of thinking about interfaces they think the ORM is the interface, but this means that the application depends on intimate knowledge of how the data is stored, a dependence the relational model is designed to get you out of. That isn't really a problem of the relational model -- as you point out, this independence is exactly what the relational model provides and so if you aren't getting it, it is because you aren't really using the relational model. Rather it is a problem of trying to eliminate relational thinking from app development.