|more useful options|
Re^4: Maybe database tables aren't such great "objects," after all ...by ELISHEVA (Prior)
|on Mar 28, 2011 at 03:22 UTC||Need Help??|
How do you maintain transactional integrity...
By encapsulation, usually as a stored procedure or sometimes, when the database engine is too limited, by a subroutine in the database interface layer.
If one person is working on an application that means that the one person needs to understand both the database and application and how they relate to one another. He or she will be responsible for deciding whether code belongs in the application layers or the database layers (stored procedures/database interface libraries).
In a larger team, it is possible that some people would only work with application objects, others would only work only with databases, and there might be a dual skilled programmer (database and OOP) working with both teams handling the mapping between the application model and the database model.
I realize it is attractive to think one can eliminate the need for dual knowledge and translation between models by collapsing the object architecture and the database into one. The skill and human resource requirements become much more complex if there really are two separate models.
However, it rarely works over the long term because databases and applications have very different goals. A database's job is to maintain the integrity of persistent data for a business or research project. Databases are fundamentally conservative. Since a database is at the center of an application ecosystem, changes to data structures are very disruptive.
By contrast, an application's job is to find ways to use that data. Applications are essentially innovative, finding ever new ways to help a business make use of its existing information resources to meet changing operational and market needs.
One of the big take-aways of normalization/database theory is that within certain constraints we can take one data structure and morph it into another more useful form. With the help of joins and projections we can create nearly any database view or object we need. In many cases we can use the same rules to automatically convert a view back into discrete tables and rows. We lose the benefit of that insight if we insist on an artificial one-to-one relationship between objects and tables.