<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 'http://www.w3.org/TR/html4/loose.dtd"'>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Object Identity</title><link rel="stylesheet" type="text/css" href="openacs.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="index.html" title="OpenACS Core Documentation"><link rel="up" href="dev-guide.html" title="Chapter 11. Development Reference"><link rel="previous" href="permissions-tediously-explained.html" title="OpenACS Permissions Tediously Explained"><link rel="next" href="programming-with-aolserver.html" title="Programming with AOLserver"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><a href="http://openacs.org"><img src="/doc/images/alex.jpg" style="border:0" alt="Alex logo"></a><table width="100%" summary="Navigation header" border="0"><tr><td width="20%" align="left"><a accesskey="p" href="permissions-tediously-explained.html">Prev</a> </td><th width="60%" align="center">Chapter 11. Development Reference</th><td width="20%" align="right"> <a accesskey="n" href="programming-with-aolserver.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="object-identity"></a>Object Identity</h2></div></div></div><div class="authorblurb"><p>By <a class="ulink" href="http://planitia.org" target="_top">Rafael H. Schloming</a></p>
          OpenACS docs are written by the named authors, and may be edited
          by OpenACS documentation staff.
        </div><p>One of the major design features of OpenACS 5.9.0 is the explicit representation
of <span class="emphasis"><em>object identity</em></span>. The reason I say "explicit
representation" is because the concept of object identity has been
around forever. It is inherent to our problem domain. Consider the example of
3.x style scoping. The 3.x data models use the triple (user_id, group_id,
scope) to <span class="emphasis"><em>identify</em></span> an <span class="emphasis"><em>object</em></span>. In the 5.9.0 data model this
object is <span class="emphasis"><em>explicitly represented</em></span> by a single party_id.</p><p>Another good example of this is can be found in the user groups data
model. The 3.x user groups data model contains another example of an
<span class="emphasis"><em>implied identity</em></span>. Every mapping between a user and a group could
have an arbitrary number of attached values (user_group_member_fields, etc.).
In this case it is the pair (group_id, user_id) that implicitly refers to an
object (the person&#39;s membership in a group). In the 5.9.0 data model this
object identity is made explicit by adding an integer primary key to the
table that maps users to groups.</p><p>Coming from a purely relational world, this might seem slightly weird at
first. The pair (group_id, user_id) is sufficient to uniquely identify the
object in question, so why have the redundant integer primary key? If you
take a closer look, it actually isn&#39;t quite so redundant. If you want to
be able to use the object model&#39;s permissioning features, and generic
attribute features on a table, you need an integer primary key for that
table. This is because you can&#39;t really write a data model in oracle that
uses more than one way to represent identity.</p><p>So, this apparently redundant primary key has saved us the trouble of
duplicating the entire generic storage system for the special case of the
user_group_map, and has saved us from implementing ad-hoc security instead of
just using acs-permissions. This design choice is further validated by the
fact that services like journals that weren&#39;t previously thought to be
generic can in fact be generically applied to membership objects, thereby
allowing us to eliminated membership state auditing columns that weren&#39;t
even capable of fully tracking the history of membership state.</p><p>The design choice of explicitly representing object identity with an
integer primary key that is derived from a globally unique sequence is the
key to eliminating redundant code and replacing it with generic <span class="emphasis"><em>object
level services</em></span>.</p><div class="cvstag">($Id: object-identity.html,v 1.49.2.12 2016/11/19 09:21:54 gustafn Exp $)</div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="permissions-tediously-explained.html">Prev</a> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right"> <a accesskey="n" href="programming-with-aolserver.html">Next</a></td></tr><tr><td width="40%" align="left">OpenACS Permissions Tediously Explained </td><td width="20%" align="center"><a accesskey="u" href="dev-guide.html">Up</a></td><td width="40%" align="right"> Programming with AOLserver</td></tr></table><hr><address><a href="mailto:docs@openacs.org">docs@openacs.org</a></address></div><a name="comments"></a></body></html>