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.


In reply to Re^4: Maybe database tables aren't such great "objects," after all ... by ELISHEVA
in thread Maybe database tables aren't such great "objects," after all ... by locked_user sundialsvc4

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.