Re: Object identity
- From: "Gabriel Claramunt" <gabclar@xxxxxxxxxxxxxxx>
- Date: Sat, 01 Jul 2006 06:56:47 GMT
We agree that it can be treated in both ways. But as an object-type,
according to your rule, there must be a 1-1 mapping between instances
and entities (in some scope). That forces a design to only allow at
most one instance to represent a given date value. That is rather
difficult to enforce in practise. That would be like ensuring there
is only one representation of the integer 0 in a given scope. In a
pure OO language like small talk you are going to have some pain!
Would you be happy to simply compare pointers to date objects and
assume different pointer values imply different date values? If a user
enters a date, how are you going to ensure there isn't another Date
object in the model with the same value, breaking your rule? What
horrible impact is this going to have on the schema?
I don't see the dificulty of implementing that (in Java at least... probably
in Smalltalk will be the same): One can hide the constructors and provide a
factory method to create the object based on the values, if a object with
that values is already instantianted, I can return it instead of creating a
new one... so you can have a 1 to 1 mapping between values and instance by
design.
On the other hand, in Java Strings behave that way: in a JVM, there's only
one instance of each string used.
I'm still confused about the point you're trying to make, but I believe that
more mathematical formalism will not solve the essential problem of software
construction.
According to Frederick P. Brooks's "No silver bullet" the essential problem
of software construction is: based on the problem to be solved, you need to
create conceptual constructs and represent those construcs in a language.
It's almost 20 years ago, but I think is still applicable.
OO helps because it makes easier the transition from the problem to the
conceptual construct (is the OOAD solution) and from the conceptual
construct to the language (OOPL program).
Even more, I believe that translation automates the last step (OOAD ->
OOPL), but still the main problem is going form the problem to the
conceptual solution.
Regards
Gabriel Claramunt
.
- Follow-Ups:
- Re: Object identity
- From: David Barrett-Lennard
- Re: Object identity
- Prev by Date: Re: Object identity
- Next by Date: Re: Object identity
- Previous by thread: Re: Object identity
- Next by thread: Re: Object identity
- Index(es):
Relevant Pages
|