JiafanZhou
版主
发贴: 736
积分: 61
|
于 2007-11-30 23:12
Having read this article carefully, I would say it is the right behaviour of JAVA. And it is what software engineers would expect Serialization to behave. Looking at this example, I would say let the interface <SuperInterface> to extends interface <Serializable> would be a good idea to make this object serializable.
There is nothing to do with Inheritance here with Serialization in this case. Let me explain later. But let me ask a question first. Why would you make some derived class to be Serializable but not the common parent classes, or abstract classes? This does *not* make sense. It is like to say a father cannot be serialized but a child can. If we implement the object model as you suggested, we just simply added some brand-new features to the derived children classes, would you agree?
Inheritance is a powerful feature, it is the harms that software engineers do not use it correctly, just like the example here.
Regards, Jiafan
When I was a kid I used to pray every night for a new bike. Then I realized that The Lord doesn't work that way, so I stole one and asked him to forgive me.
|