Design and Architecture of Complex Software Systems (DACSS)
Assignment 2: The Reflection Pattern - Track A: Using reflective
features of programming languages
MySerializer
This is one of the choices for Assignhment 2.
Assignment description
Using the reflective capabilities of java (java.lang.reflection)
or .NET (System.Reflection)
implement a simple serializer/deserializer system, allowing to save/restore
the state of objects in/from files).
The serializable objects may have fields that are of primitrive types, objects or arrays. The format of the files used to save the object state can be freely chosen.
Following simplifying assumptions can be applied: there are no inherited fields; there are no different fields that have as values references to the same object.
Bonus 1 point: solving the
simplifying assumptions mentioned before (you must be able to serialize
objects that have fields inherited from multiple ancestor levels;
you must treat the situation when different fields have as values
references to the same object - the object state should not be written twice; you must be
able to serialize objects that have as fields other random objects;
you must be able to serialize arrays of random complex objects.).
You have to demonstrate all the possible cases in a test program
(show initial objects, before your serialization, then compare with restored after your deserialization - compare.
You can still maintain the assumptions that all serializable objects have a no-args constructor.
Bibliography
- Lecture notes from weeks 4 and 5 link
- The Java tutorials - The reflection API link
- MSDN - Reflection overview link