Changeset 2179

Show
Ignore:
Timestamp:
08/29/2007 09:17:55 PM (17 months ago)
Author:
wei
Message:

add design implications

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/demos/quickstart/protected/pages/Database/ActiveRecord.page

    r2136 r2179  
    5151        <li>Lazy loading of relationships.</li> 
    5252    </ul> 
     53<h2>Design Implications</h2> 
     54<p> 
     55Prado's implementation of Active Record does not maintain referential identity. Each object obtained using  
     56Active Record is a copy of the data in the database. For example, If you ask for  
     57a particular customer and get back a <tt>Customer</tt> object, the next time you ask for  
     58that customer you get back another instance of a <tt>Customer</tt> object. This implies that a strict 
     59comparison (i.e., using <tt>===</tt>) will return false, while loose comparison (i.e., using <tt>==</tt>) will 
     60return true if the object values are equal by loose comparison.  
     61<p> 
     62<p> 
     63This is design implication related to the following question. 
     64<i>"Do you think of the customer as an object, of which there's only one,  
     65or do you think of the objects you operate on as <b>copies</b> of the database?"</i> 
     66Other O/R mappings will imply that there is only one Customer object with custID 100, and it literally is that customer.  
     67If you get the customer and change a field on it, then you have now changed that customer.  
     68<i>"That constrasts with: you have changed this copy of the customer, but not that copy.  
     69And if two people update the customer on two copies of the object, whoever updates first,  
     70or maybe last, wins."</i> [A. Hejlsberg 2003] 
     71</p> 
     72 
    5373<h2 id="142010">Database Supported</h2> 
    5474<p id="p1" class="block-content"> 
     
    10441064    <li>Fowler et. al. <i>Patterns of Enterprise Application Architecture</i>, 
    10451065    Addison Wesley, 2002.</li> 
     1066        <li>B. Venners with B. Eckel. <i><a href="http://www.artima.com/intv/abstract3.html">Inappropriate Abstractions - A Conversation with Anders Hejlsberg, Part VI.</a></i> 
     1067        Artima Developer, 2003. 
     1068        </li> 
     1069 
    10461070</ul> 
    10471071