Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am interesting in the pros and cons of serialization: intrusive and non-intrusive.

On the one hand it seems non-intrusive is easy to use - class to be serialized should not be updated. It seems convenient for simple cases. E.g. XStream.Net implements such approach.

But the issues can appear if this class is connected in some way with other classes, e.g. stores indices of global objects which should be serialized as well. In this case non-intrusive approach looks dangerous.

Concerning intrusive implementation. It is good that developer can directly specify what and how to serialize (of course if serialization technology is flexible enough).
E.g. Microsoft .Net has intrusive approach implemented for XML serialization - attributes should be specified for classes and members.

Other ideas?

share|improve this question
    
what language do you use? –  Yusubov Jul 28 '12 at 21:56
    
C#, but I am interested more in general idea in this question. Anyway, language specific notes are welcome as well. –  sergtk Jul 28 '12 at 21:58
add comment

1 Answer

From C++ perspective there is a very informative article, which every developer needs to read at once. It basically lays down the difference in serialization for approached intrusive and non-intrusive.

A practical guide to C++ serialization is another well written source to be aware of. More info from Boost C++ libraries on Serializable Concept.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.