Aside: Problems with Using Serialization for Component Creation

If component creation is done by reading a serialized version, the options for configuration are more limited, since serialized forms cannot reference anything dynamic, for example the name of a file that could not be opened during program execution. At least some properties need to be set in code, which means the same problems associated with compiled code arise.

In addition, programmers must ensure subclassed components implement Serializable correctly, which can be tricky.

If a component needs to look slightly different in another locale, another serialized form needs to be stored especially for the locale, and the choice of which serialized form to use must be done in code. Alternatively, all the locale-dependent properties would have to be set manually with Java code.

In summary, using serialization for component creation, although fast, is neither flexible nor robust enough for many needs.