body { margin:0; padding:0; font-family:times; font-size:9pt; } p { margin-top:5; margin-bottom:5; font-weight:plain; font-family:serif; font-size:9pt; } h1 { margin-top:5; font-size:16pt; font-weight:bold; text-align:center; font-family:sans-serif; } h2 { margin-top:20; font-size:10pt; font-weight:bold; text-align:left; font-family:sans-serif; } pre { color:#993333; font-size:9pt; } code { color:#993333; } th { background-color:#AAAAAA; } .section { text-align:justify; padding:5; }
r-value Data in an l-value WorldC and C++ programmers should be familiar with l-values, if only because
they should at some time have seen then mentioned in a compiler error message:
error: not an l-value
This message indicates that an invalid attempt has been made to take the address of an element. For example:
12 = 13;
or
int * v = &12;
It is often explained that an l-value is an expression that can be placed
on the "left hand side" of an assignment statement, and an r-value an expression
that can be placed on the "right hand side".
A better explanation (though not guaranteed correct) is that the "L" stands for "location" and
the "R" register from the earlier days of machine code and instruction sets with accumulators and
address and data registers. An l-value is a "location" value in an address register
and an r-value a "register" value held in a data register.
Yep, I think so. Because an appreciation of what this really means can inform system design at all levels.
Consideration of the difference between r-values and l-values
helps to understand the applicability of Object Oriented techniques and why relational databases
have such a problem with referential integrity.
l-value) WorldThe real world is full of real things. For something to exist it must occupy a space in space-time. "Values" do not exist by themselves, they are "properties" or "attributes" of some thing.
Location is equivalent to identity.
not an l-value: Procedural ProgrammingProcedural Programming does not directly address the issue of "things" with identity/location.
Some global data structures must be defined that the procedures will then side-effect. Initially this was a simple way to think of computer programming, but it has turned out that it is not a very scalable approach to dealing with systems that must manage ever larger amounts of ever more complex data.
not an l-value: Relational DatabaseA relational database stores values. The only true identies maintained are the database itself and the addressable tables within.
This leads directly to the known problem of referential integrity. That the tables, so far as the database is concerned simply contain a number of typed values.
The "workaround" to the problem of referential integrity is to define external "integrity constraints" or "triggers". But it is commonly recognised that such approaches should only be used in specific situations. Hardly a generic and scalable solution.
not an l-value: ODBCODBC is a way to get values from a database.
Most languages provide "objects" that use ODBC and help to extract the values.
Java provides JDBC - a java binding to ODBC.
But although these utilities are objects, they themselves do not provide identity to the values they retrieve. They are no more than simple parameterized procedures.
Yes, they help in retrieving data from a database, but that's it.
not an l-value: EJBYou would think that with all the Objects in J2EE/EJB that there would be some concept of identity.
Well, yes, there is. Identity of program state, transactions etc. All very important (if confusing) stuff.
But absolutely no concept of data identity.
At the end of the day the J2EE/EJB frameworks are simply about extracting a value from some data source and moving it around (quite a lot).
l-value: Object Oriented ProgrammingThe key property of Object Oriented Programming is that Objects have identity.
An Object reference is an l-value.
From this everything else follows. The object reference indicates a location that may
have other l-values, for example to a structure that contains funtion/method
l-values to enable the feature we describe as "Polymorphism".
But the key thing is that an Object has Identity, and the reason it has
identity is because it has a location.
l-value: Object Persistence ModelA Persistent object model should primarily concern itself with maintaining the identity of the object. Sure some mechanism is needed to save and restore the object, but that is secondary to maintaining identity.
So, if it is possible to retrieve two "copies" of the "same object", that is not a persistent object system.
It is almost laughable when the "Object/Relational" boys claim that being able to store an "Object" as a value in a table column provides support for Object Oriented programming.
l-value worldCheck out the main Cut The Crap Website to learn more about the Generic Persistent Object model.
GPO was designed from the ground up to help solve real world modelling problems and to
do it in such a way that developers can concentrate on real problems rather than in
converting r-value data into an l-value world!
If you have any comments/questions on this paper or the "Cut The Crap" technology, please email the author.