Hello,
I'm looking to improve current implementation, and maybe you can help me.
The current procedure is based in a custom serialization of each
MooseElement. It's inspired on MSE, I describe this with the following
pseudo-code:
serialize: aMooseElement
(MooseModel meta descriptionOf: aMooseElement class) allAttributes
do: [ :anAttribute |
| values |
values := anAttribute getFrom: aMooseElement.
(self shouldIgnore: anAttribute withAll: values)
ifFalse: [ self serialize: anAttribute withAll: values ] ].
where:
shouldIgnore: anAttribute withAll: values
^ values isEmpty or: [
anAttribute isDerived or: [
anAttribute type == FM3MetaDescription boolean and: [
values size == 1 and: [
values first == false ]]]]
The advantage of serializing the MooseElements in this way (and not just as
a normal object) is to avoid storing unnecessary stuff that aMooseElement
references.
It's a disadvantage using FM3PropertyDescription>>getFrom: (and then to
import, FM3PropertyDescription>>setOn:values:) which ends sending #perform:
of the corresponding accessor selector. It'd be better to use #instVarAt:
(and #instVarAt:put:) as Fuel normally does.
I hope I've been clear enough to explain up to this point. Now my question:
Do you think Fuel can do something on each MooseElement like
- clean up some unnecessary references
- declare some instance variables as transient
- if it's not good idea to modify the elements, create a method like
MooseElement>>copyWithoutDerivedValues, and so actually serialize such copy
instead of the original element
- any other
???
and thus, serialize the MooseElements as normal Fuel objects, removing the
custom procedure.
I'll be happy to receive some help from Moose and Fame experts!
Thanks in advance.
Martín