Hi, Providing a Serializable interface looks more uniform. However, if more and more classes implement this interface, it may be hard for developers to find usage of a specific class, such as PageHeader.serialize or ChunkHeader.serialize. This may be a problem...
Thanks, -- Jialin Qiao School of Software, Tsinghua University 乔嘉林 清华大学 软件学院 > -----原始邮件----- > 发件人: "Xiangdong Huang" <[email protected]> > 发送时间: 2020-05-27 08:37:25 (星期三) > 收件人: [email protected] > 抄送: > 主题: Re: Serialization discussion > > Hi Giorgio, > > I think it is ok to abstract the two methods as an interface. > But what do you think about the deserializeFrom() method? > > > since we use our free time and weekends. > Many thanks for your effort :D > > Best, > ----------------------------------- > Xiangdong Huang > School of Software, Tsinghua University > > 黄向东 > 清华大学 软件学院 > > > Giorgio Zoppi <[email protected]> 于2020年5月27日周三 上午5:20写道: > > > > > On 5/26/20 4:46 PM, Xiangdong Huang wrote: > > > Hi Giorgio, > > > > > > Welcome to discuss the class/interface design. > > > I believe there must be a lot of class/interface design we can improve in > > > the current implementation. > > > > > > Are you talking about the PageHeader and ChunkHeader? > > > IMO, they are considered as JavaBeans, and serialization/deserialization > > > methods are needed (if we do not use java.io.Serializable) > > > > Yes, but suggest to create an appropriate interface, because if i need > > to test only those, i can mock. Example. > > > > public interface DataSerializable { > > > > void serializeTo(OutputStream stream) throws SerializationException; > > > > void serializeTo(ByteBuffer buffer) throws SerializationException; > > > > } > > > > public class PageHeader implements DataSerializable { > > > > } > > > > So you can treat a PageHeader, ChunkHeader as the think and create > > composition > > > > while deserializing. This will our development for us because we can > > just implement DataSerializable and mock > > > > whatever we want without importing the real implementation. > > > > This is my point, if the community agrees i can provide a PR. We are > > slowly progressing with the native but still a lot of time is needed > > > > since we use our free time and weekends. > > > > Best Regards, > > > > Giorgio. > > > > > > > >
