Object <--> some string ObjectIdentity

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Object <--> some string ObjectIdentity

Sophie424
I need to get some unique "identity" string for my objects, and subsequently
to find that object from that string. How can I do this?

Thanks - Sophie



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Object <--> some string ObjectIdentity

Bert Freudenberg
On 01.05.2008, at 19:11, itsme213 wrote:

> I need to get some unique "identity" string for my objects, and  
> subsequently
> to find that object from that string. How can I do this?


I don't think there is an elegant way to do this. You would have to  
create a registry for all your objects, and give them an id when they  
are created.

- Bert -


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

RE: Object <--> some string ObjectIdentity

Ramon Leon-5
In reply to this post by Sophie424
> I need to get some unique "identity" string for my objects,
> and subsequently
> to find that object from that string. How can I do this?
>
> Thanks - Sophie

UUID new asString36

Ramon Leon
http://onsmalltalk.com

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Object <--> some string ObjectIdentity

Lukas Renggli
In reply to this post by Bert Freudenberg
> > I need to get some unique "identity" string for my objects, and
> subsequently
> > to find that object from that string. How can I do this?
>
>  I don't think there is an elegant way to do this. You would have to create
> a registry for all your objects, and give them an id when they are created.

In most Smalltalk implementations you probably can't avoid maintaining
your own registry. A big part of Seaside consist of maintaing such
tables: dispatcher to applications, applications to sessions (_s),
sessions to continuations (_k), continuations to callbacks, etc. There
are many named objects, some with random identifiers (WAExternalId),
some with user-defined identifiers, and some are simply numbered.

GemStone is the exception here. Every object has an unique ID by
itself, that can also be used to retrieve that particular object.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Object <--> some string ObjectIdentity

Sophie424
In reply to this post by Ramon Leon-5
"Ramon Leon" <[hidden email]> wrote

>> I need to get some unique "identity" string for my objects,
>> and subsequently
>> to find that object from that string. How can I do this?
>>
>> Thanks - Sophie
>
> UUID new asString36

In a Seaside app when do you find it useful to generate these for some of
your domain objects? WA components?

Sophie



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

RE: Re: Object <--> some string ObjectIdentity

Ramon Leon-5
>
> "Ramon Leon" <[hidden email]> wrote
>
> >> I need to get some unique "identity" string for my objects,
> >> and subsequently
> >> to find that object from that string. How can I do this?
> >>
> >> Thanks - Sophie
> >
> > UUID new asString36
>
> In a Seaside app when do you find it useful to generate these
> for some of
> your domain objects? WA components?
>
> Sophie

I generate an id for my domain objects in initialize.  All my domain objects
answer to #id, see my SandstoneDb package on SqueakSource.  For
WAComponents, I don't bother, if I need an id for ajax purposes I use either
html nextId, or use my domain objects id with some prefix or postfix.

Ramon Leon
http://onsmalltalk.com

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Re: Object <--> some string ObjectIdentity

Lukas Renggli
> I generate an id for my domain objects in initialize.  All my domain objects
>  answer to #id, see my SandstoneDb package on SqueakSource.  For
>  WAComponents, I don't bother, if I need an id for ajax purposes I use either
>  html nextId, or use my domain objects id with some prefix or postfix.

That doesn't answer how you get to the object, if you only know the ID
though ;-)

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

RE: Re: Object <--> some string ObjectIdentity

Ramon Leon-5
> > I generate an id for my domain objects in initialize.  All
> my domain objects
> >  answer to #id, see my SandstoneDb package on SqueakSource.  For
> >  WAComponents, I don't bother, if I need an id for ajax
> purposes I use either
> >  html nextId, or use my domain objects id with some prefix
> or postfix.
>
> That doesn't answer how you get to the object, if you only know the ID
> though ;-)
>
> Lukas

True, but I'm assuming Sophie knows how to use a Dictionary to hash any
objects she needs by id.  If not, she can certainly find examples in the
package I mentioned.

Ramon Leon
http://onsmalltalk.com

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners