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 <giorgio.zo...@gmail.com> 于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. > > > >