Comparing object graphs (was: The future of SM...)

Stephan Rudlof sr at evolgo.de
Tue Jul 20 20:37:31 UTC 2004


Chris Muller wrote:
>>>So... I want a smart Smalltalk diff/patch but for *objects* and not 
>>>Strings. Anyone up to the task? Magma should in essence already have 
>>>this capability somewhere in there I think. :)
>>
>>Well, I've been working on something a bit like this for Monticello. 
>>The thing is, a general diff/patch algorithm for arbitrary graphs of 
>>objects is really, really hard..
> 
> 
> I tried to conquer this problem, but eventually gave up.  The code for my
> attempt is still in the MagmaTester on SM, for anyone interested.  Once loaded,
> look at the class MaObjectGraphComparer.  You create an instance of that by
> providing two objects you want to compare.  It then does serialization and
> compares the buffers to do its work.
> 
> It's been a long time since I messed with it, and my goal was only a reasonable
> determination of whether two object-graphs were equivalent (so I could use it
> for Magma's test cases).  It was too hard to get it to work with complex
> graphs.
> 
> An interesting, very tough problem..  Too tough for me.

Some way to go is to look for XML diff algorithms. They compare XML files.

A Smalltalk class hierarchy can be exported as XML:
- classes
  - name
  - superclass name
  - inst var names
  - method names
  - method bytecode hashes (!)
  - optional: method source (not so important than the previous point)
...
After that these XML exports could be diffed.

Of course the diff problem is hard and the patch problem is harder than
that: there are more than one ways to convert one XML graph into another...
But the benefit is to get an idea of
- how far two different Smalltalk systems are away from each other,
- *where* they differ,
- and - last but not least - how much the porting effort of some
software could be ... (!)

Just to give a few ideas...


Greetings
Stephan

> 
>  - Chris
> 
> 

-- 
Stephan Rudlof (sr at evolgo.de)
   "Genius doesn't work on an assembly line basis.
    You can't simply say, 'Today I will be brilliant.'"
    -- Kirk, "The Ultimate Computer", stardate 4731.3



More information about the Squeak-dev mailing list