Download Tool Support for Introductory Software Engineering Education
Transcript
reverse direction, the field data will not be in the stream and so the field will have to be initialised to a default value. This change is considered incompatible according to the JOS definition, but the evolution will work as long as the old version of the class can cope with the data in the deleted field being set to a default value. 2. Moving classes up or down the hierarchy The object data from each level in the hierarchy is serialized in order, so moving classes up or down the hierarchy means that data will not be available from the stream when required. 3. Changing a non-static field to static or a non-transient field to transient This is identical to deleting a field because marking the field transient or changing it to static means that it will now not be written out into the stream. 4. Changing the declared type of a primitive field The type of all primitive fields are serialized along with the data so if the field type is changed then the object can no longer be demarshalled because it will expect a different type. JOS supports many of the forms of evolution that would be required by BlueJ. An important evolution that it does not support is renaming of fields (technically just a delete field and an add field but rename field needs to retain the value of the field). More importantly, in the cases where JOS does not work it fails without any means of correction. The serialized data is in a binary format and so it cannot be examined to make potentially simple corrections. For this reason, and because of the need for the source code to be tagged as Serializable, requiring modification of the source code, JOS is unsuitable for use as the serialization technique in BlueJ. 131