From 913a2a6e7f036126d123a6b51c5826726246e912 Mon Sep 17 00:00:00 2001 From: wei <> Date: Thu, 30 Aug 2007 02:17:55 +0000 Subject: add design implications --- .../protected/pages/Database/ActiveRecord.page | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'demos') diff --git a/demos/quickstart/protected/pages/Database/ActiveRecord.page b/demos/quickstart/protected/pages/Database/ActiveRecord.page index e5ddcdfd..481985e9 100644 --- a/demos/quickstart/protected/pages/Database/ActiveRecord.page +++ b/demos/quickstart/protected/pages/Database/ActiveRecord.page @@ -50,6 +50,26 @@
  • Fetch relationships (related foreign objects) such as "has many", "has one", "belongs to" and "has many" via association table.
  • Lazy loading of relationships.
  • +

    Design Implications

    +

    +Prado's implementation of Active Record does not maintain referential identity. Each object obtained using +Active Record is a copy of the data in the database. For example, If you ask for +a particular customer and get back a Customer object, the next time you ask for +that customer you get back another instance of a Customer object. This implies that a strict +comparison (i.e., using ===) will return false, while loose comparison (i.e., using ==) will +return true if the object values are equal by loose comparison. +

    +

    +This is design implication related to the following question. +"Do you think of the customer as an object, of which there's only one, +or do you think of the objects you operate on as copies of the database?" +Other O/R mappings will imply that there is only one Customer object with custID 100, and it literally is that customer. +If you get the customer and change a field on it, then you have now changed that customer. +"That constrasts with: you have changed this copy of the customer, but not that copy. +And if two people update the customer on two copies of the object, whoever updates first, +or maybe last, wins." [A. Hejlsberg 2003] +

    +

    Database Supported

    The Active Record implementation utilizes the Prado DAO classes for data access. @@ -1043,6 +1063,10 @@ will be thrown.

    $Id$
    \ No newline at end of file -- cgit v1.2.3