Re: Is this bad design ?
Date: Tue, 30 Mar 2004 15:35:24 -0500
> But, if database access is encapsulated in one class/package/module in
> your application, it should be possible to change the database schema
> without too much side effects?
This is a misuse of encapsulation. The state of an object is encapsulated,
but its behaviour is not.
A transaction, once committed, becomes visible to anyone who has access to the database, whether they use the original class/package/module or not. A database whose data model is subject to change without advance warning is not a reliable data source.
The whole idea behind databases is to share data between participants who share a common data model, but not necessarily the same process model. The whole idea behind encapsulation is to hide information.
You can hide information, or you can share data. But you can't to both at the same time, and in the same place. Received on Tue Mar 30 2004 - 22:35:24 CEST