locked
Advantages and disadvantages of Serialization? RRS feed

  • Question

  • Hi,

    I understand what serialization is all about. But I could not understand the benefits of using it.

    For eg. If we want to pass data through a network or webservice we can pass it using models (Entity object or collection) also.

    Then why we need Serialisation?

    I have gone through this link.

    If this is so then why it is used?


    Every day its a new learning. Keep Learning!! >/b> If this post answers your question, please click "Mark As Answer". If this post is helpful please click "Mark as Helpful"
    • Edited by Tiya01 Thursday, December 22, 2011 11:52 AM
    Thursday, December 22, 2011 11:44 AM

All replies

  • Hi Tiya ,

              Check with the below links. Hope it will help you.

    http://aspalliance.com/983_Introducing_Serialization_in_NET.3

    http://www.jguru.com/faq/view.jsp?EID=5068


    If my answer solve your problem,Please click "Mark As Answer" on that post and "Mark as Helpful". Manikandan
    Thursday, December 22, 2011 1:04 PM
  • Hi Manikandan J,

    Thanks for you response. But I already have gone through and understood these.

    Pls let me know following, as per the best practices :

    • One should go for serialization or not?
    • Whether the performance overhead is ignorable as one needs streamed cross network data?

    Thanks!


    Every day its a new learning. Keep Learning!!
    If this post answers your question, please click Mark As Answer . If this post is helpful please click Mark as Helpful
    Friday, December 23, 2011 5:56 AM
  • Hi,

    • If we want to pass data over network or services we can pass it using models. But how the models are described ? is it a XML or Plain Text or Binary Data etc... In most of the scenarios if we don't want to use XML we can use pipe separated plain text which we need to write a code to read in memory model and create this. Serlization will help you to avoid the manual coding that is required to create such things. You can use XML or Binary Serlization with different formatters and it is easy to use and implement
    • On the down side the process will take memory and CPU usage to construct data in memory either XML or Binary. But the overhead is more if it is XML and this is not real scenario where you model data can be in KBytes.

     

    Thanks,


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful". Sudhakar
    Friday, December 30, 2011 2:01 PM
  • Best Practices

    • Use XML Serialization for better interoperable and flexible but leas on performance
    • Use Binary Serialization if you want to share data which has same model used. Including full type of a type
    • Don't use serialization to transfer large data instead use binary streams
    • Don't use serialization on big object
    • Use custom serialization implementation to select the data as per requirement to serialize instead of including all data. (Use XmlIgnore etc...)
    • Use of XML Serlization for primitive data type models will be faster instead of complex types

     


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful". Sudhakar
    Friday, December 30, 2011 2:06 PM