| Summary: | If you ever have a complex object that contains a number of other objects, and want to implement a deep copy -- a copy of the object and the objects to which it refers -- you know you're in for a painful and time-consuming task. This is because the default behavior of an object's clone() method automatically yields a shallow copy (a copy that excludes contained objects) -- so, to achieve a deep copy, classes must be manually edited or extended. If an object has a complex graph, then this process will result in an extensive coding effort. The technique presented in this article is a simple alternative to this difficult procedure, and takes advantage of functionality provided by serialization. (2,000 words)
|