harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov" <alexei.zakha...@gmail.com>
Subject Re: [classlib][beans] Code seems duplicate for primitive persistence delegate
Date Thu, 12 Jul 2007 09:13:27 GMT

I don't see many reasons to couple all persistence delegates into a
single class. IMO "one  class to one persistence delegate" model is
obvious and easy to understand. AFAIU RI implements its persistence
delegates in this way. BTW what do you mean by code duplication here?
The behavior of instantiate() method is unique to each PD and all that
we can do is to create a single class with a big big switch that
includes the code from all our PDs. Do we really want this? IMHO it is
not an Object-Oriented way.

Sorry if I misunderstand your idea. Please explain in more details if so.


2007/7/12, Spark Shen <smallsmallorgan@gmail.com>:
> During developing PersistenceDelegate for java.lang.reflect.Field, I find
> code duplication in many primitive type persistence delegate.
> There are 8 primitiveType persistenceDelegate:
> java_lang_BooleanPersistenceDelegate
> java_lang_BytePersistenceDelegate
> java_lang_CharacterPersistenceDelegate
> java_lang_DoublePersistenceDelegate
> java_lang_FloatPersistenceDelegate
> java_lang_IntegerPersistenceDelegate
> java_lang_LongPersistenceDelegate
> java_lang_ShortPersistenceDelegate
> Each of the 8 class has two method: instantiate & initialize, and the logic
> of the 2 methods are similar.
> IMO, we could use one PrimitiveTypePersistenceDelegate instead to reduce
> code duplication.
> --
> Spark Shen
> China Software Development Lab, IBM

Alexei Zakharov,
Intel ESSD

View raw message