dukeboard / kevoree-modeling-framework

Kevoree Modeling Framework
http://kevoree.org/kmf
GNU Lesser General Public License v3.0
37 stars 7 forks source link

.equals in KMF #32

Closed brice-morin closed 11 years ago

brice-morin commented 11 years ago

Is there a particular (I mean, useful) semantic on the .equals in KMF? Or is it stupidly mapped to java.lang.Object.equals (i.e. not overidden), which itself is basically mapped to Java's ==, which is not so useful in practice, e.g. if I am comparing two models (having of course all their elements !=...)

brice-morin commented 11 years ago

My typical use case: I basically want to test that KMF loaders and serializers work as they should i.e. (in pseudo-code)

myModel = load(...)
save(myModel, ...)
myNewModel = load(...)
assertTrue(myModel.equals(myNewModel))//should be true, if loader and serializer work fine

I am of course not interested in testing:

assertTrue(myModel == myNewModel)//will always be false, since objects are distincts, but equals (in principle)

with == to be interpreted in the Java sense

brice-morin commented 11 years ago

A good source of inspiration might be: https://code.google.com/p/deep-equals/source/browse/deep-equals/java/com/cedarsoftware/util/DeepEquals.java

Of course, the generative approach of KMF should avoid all those reflexive calls, since we now exactly what we want to compare :-)

gnain commented 11 years ago

Closed by 19ec581de17965e923a07b08dd7dd1c435c4468c

brice-morin commented 11 years ago

I am very happy for now, but might come back some time soon on that topic :-)