Today some information about object serialization without any examples, which are going to be in a 2nd part of this article (nearest future).
What does serialization mean? Why should/shouldn’t I use it?
You have a huge IT project and someone asked you to make some optimization. It is too slow, it needs too much memory. What should you do? Think about XML serialization. You can use your object, and then serialize it to file with .xml extension (serialize means that we PUT our object outside of a program, and save to a database or .xml file – it allows to have each object only in places in which it is needed). When you need to use it again, you should take it back from db or file – it is called deserialization.
1. Project contains a lot of animals (objects).
2. In each part of a program we need only a few of them, so it is meaningless to have all of them in our memory.
3. In response to this problem use serialization which allows you to pack all of them to an outside file. When you need a lion you take lion, when you need a cat you take cat etc.
4. When all operations are done, you deserialize your object.
5. Your application is faster and easier to support.
Of course, I know that it is hard to understand without any examples, but I promise that I will write a sample in a few days.