You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Emmanuel Lecharny <el...@gmail.com> on 2011/03/01 16:58:09 UTC

Serializers

Hi guys,

Last week, I started to rewrite the serializers, creating some dedicated 
classes for each element needing to be serialized.

Each class contains a serialize()/deserialize() method.

I'm now wondering if it wound't be better to simply move those static 
classes into the main classes being serialized/deserialized. Alex does 
think so, and I'm on line whith his option.

The reason why I created an additional class was to avoid modifying the 
main classes. Also not that the class implementing Externalizable will 
call those dedicated methods.

Thoughts ?

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com


Re: Serializers

Posted by Alex Karasulu <ak...@apache.org>.
On Tue, Mar 1, 2011 at 11:51 PM, Emmanuel Lecharny <el...@gmail.com>wrote:

> I was a bit optimistic saying that we should merge the serializers with the
> classes that are operating on : the problem is that if we do that, we will
> have to call methods like :
> DefaultEntryAttribute.serialize()
>
> Not very convenient. I think it's probably better to have an
> EntryAtrributeSerializer helper class instead of static methods in classes.
> As a matter of fact, for Entry, we may have bigger trouble : should the
> methods be injected into DefaultEntry ? Or ClonedServerEntry ?  Or
> ImmutableEntry ? Or ClonedServerEntrySearch ? ...
>
> See what I mean, I guess.
>
>
Yes you're right. Serialization is an aspect that is applied on the
interface rather on a specific implementation. It's best to have it
separate.

The best way sometimes to figure out the right path is just start coding.
The problems come out and show you the path.

Regards,
Alex

Re: Serializers

Posted by Emmanuel Lecharny <el...@gmail.com>.
I was a bit optimistic saying that we should merge the serializers with 
the classes that are operating on : the problem is that if we do that, 
we will have to call methods like :
DefaultEntryAttribute.serialize()

Not very convenient. I think it's probably better to have an 
EntryAtrributeSerializer helper class instead of static methods in 
classes. As a matter of fact, for Entry, we may have bigger trouble : 
should the methods be injected into DefaultEntry ? Or ClonedServerEntry 
?  Or ImmutableEntry ? Or ClonedServerEntrySearch ? ...

See what I mean, I guess.

On 3/1/11 4:58 PM, Emmanuel Lecharny wrote:
> Hi guys,
>
> Last week, I started to rewrite the serializers, creating some 
> dedicated classes for each element needing to be serialized.
>
> Each class contains a serialize()/deserialize() method.
>
> I'm now wondering if it wound't be better to simply move those static 
> classes into the main classes being serialized/deserialized. Alex does 
> think so, and I'm on line whith his option.
>
> The reason why I created an additional class was to avoid modifying 
> the main classes. Also not that the class implementing Externalizable 
> will call those dedicated methods.
>
> Thoughts ?
>


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com