Object visitor

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

Object visitor

tinchodias
Hi,

We want to do some processing over the graph of object references.

Do you recommend an implementation of visitor pattern to iterate object instance variables?

Best regards,
Martin and Tristan

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Object visitor

Alexandre Bergel
Yes.
Visitor is a convenient pattern to perform a computation over each element of a recursive data structure.
This pattern works well for trees. You need to pay attention to cycle when using it on a graph. This might be expensive if you have a large graph and you use a set to keep track of the element you run over.

Do you want to do this on any object of the image?

Alexandre


On 2 Sep 2010, at 10:36, Martin Dias wrote:

> Hi,
>
> We want to do some processing over the graph of object references.
>
> Do you recommend an implementation of visitor pattern to iterate object instance variables?
>
> Best regards,
> Martin and Tristan
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Object visitor

tinchodias


On Thu, Sep 2, 2010 at 4:53 PM, Alexandre Bergel <[hidden email]> wrote:
Yes.
Visitor is a convenient pattern to perform a computation over each element of a recursive data structure.
This pattern works well for trees. You need to pay attention to cycle when using it on a graph. This might be expensive if you have a large graph and you use a set to keep track of the element you run over.


It has to be as faster as possible, but I think that the Set would be ok.


 
Do you want to do this on any object of the image?


Yes, for any object. It's for serializing a graph of objects into a stream. We need to iterate over the transitive closure of object references.

Do you know an existing package that implements this pattern?



 
Alexandre


 
Thank you for the answer 
Martin


 
On 2 Sep 2010, at 10:36, Martin Dias wrote:

> Hi,
>
> We want to do some processing over the graph of object references.
>
> Do you recommend an implementation of visitor pattern to iterate object instance variables?
>
> Best regards,
> Martin and Tristan
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Object visitor

Alexandre Bergel
The Pharo image already provides some infrastructure: SmartRefStream, ImageSegment and friends.
Maybe Mariano could provide an extended answer...

Cheers,
Alexandre

On 3 Sep 2010, at 03:54, Martin Dias wrote:

>
>
> On Thu, Sep 2, 2010 at 4:53 PM, Alexandre Bergel <[hidden email]> wrote:
> Yes.
> Visitor is a convenient pattern to perform a computation over each element of a recursive data structure.
> This pattern works well for trees. You need to pay attention to cycle when using it on a graph. This might be expensive if you have a large graph and you use a set to keep track of the element you run over.
>
>
> It has to be as faster as possible, but I think that the Set would be ok.
>
>
>  
> Do you want to do this on any object of the image?
>
>
> Yes, for any object. It's for serializing a graph of objects into a stream. We need to iterate over the transitive closure of object references.
>
> Do you know an existing package that implements this pattern?
>
>
>
>  
> Alexandre
>
>
>  
> Thank you for the answer
> Martin
>
>
>  
> On 2 Sep 2010, at 10:36, Martin Dias wrote:
>
> > Hi,
> >
> > We want to do some processing over the graph of object references.
> >
> > Do you recommend an implementation of visitor pattern to iterate object instance variables?
> >
> > Best regards,
> > Martin and Tristan
> > _______________________________________________
> > Pharo-project mailing list
> > [hidden email]
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Object visitor

Mariano Martinez Peck
In reply to this post by tinchodias
Hi Martin, a couple of questions:

- What you want to do with each obejct?  I mean, you want to traverse the graph...ok, but to do what?
- Do you want to do it at VM or image side? Is speed important?

But as Alexandre said, you can take a look to ReferenceStream or ImageSegment.
In VM side you can see the GC stuff for example.

Cheers

Mariano


2010/9/2 Martin Dias <[hidden email]>
Hi,

We want to do some processing over the graph of object references.

Do you recommend an implementation of visitor pattern to iterate object instance variables?

Best regards,
Martin and Tristan

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Object visitor

Chris Muller-3
In reply to this post by tinchodias
Hi Martin, the "Ma object serialization" package also handles object
serialization.  It is available by loading the
ConfigurationOfMagmaClient.

2010/9/3 Martin Dias <[hidden email]>:

>
>
> On Thu, Sep 2, 2010 at 4:53 PM, Alexandre Bergel <[hidden email]>
> wrote:
>>
>> Yes.
>> Visitor is a convenient pattern to perform a computation over each element
>> of a recursive data structure.
>> This pattern works well for trees. You need to pay attention to cycle when
>> using it on a graph. This might be expensive if you have a large graph and
>> you use a set to keep track of the element you run over.
>>
>
> It has to be as faster as possible, but I think that the Set would be ok.
>
>
>>
>> Do you want to do this on any object of the image?
>>
>
> Yes, for any object. It's for serializing a graph of objects into a
> stream. We need to iterate over the transitive closure of object references.
> Do you know an existing package that implements this pattern?
>
>
>
>>
>> Alexandre
>>
>>
>
> Thank you for the answer
> Martin
>
>
>>
>> On 2 Sep 2010, at 10:36, Martin Dias wrote:
>>
>> > Hi,
>> >
>> > We want to do some processing over the graph of object references.
>> >
>> > Do you recommend an implementation of visitor pattern to iterate object
>> > instance variables?
>> >
>> > Best regards,
>> > Martin and Tristan
>> > _______________________________________________
>> > Pharo-project mailing list
>> > [hidden email]
>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project