zoukankan      html  css  js  c++  java
  • Persistence VS Serialization

    1. Persistence in computer science refers to the characteristic of state that outlives the process that created it.

    2. Serializatioin. In computer science, in the context of data storage and transmission, serialization is the process of converting a data structure or object into a format that can be stored (for example, in a file or memory buffer, or transmitted across a network connection link) and "resurrected" later in the same or another computer environment.[1] When the resulting series of bits is reread according to the serialization format, it can be used to create a semantically identical clone of the original object. For many complex objects, such as those that make extensive use of references, this process is not straightforward.

    This process of serializing an object is also called deflating or marshalling an object.[2] The opposite operation, extracting a data structure from a series of bytes, is deserialization (which is also called inflating or unmarshalling).

    3. Serialization is just the ability to convert an object into a stream. It can be used for persistence, such as saving the stream to a file (or a DB). But it can also be used for other stuff too. For example, you can send the stream to another machine on the network to deserialize -- in that example, serialization is the transport to get an object across the network.

    Peristence is the ability of an object to save its state. You can use serialization for this. Or you can just save your own variables to a file. Or a DB. Or a network service. Etc. Etc. Etc.

    4. Another comparison comment:

    Serialization: Also known as streaming. It is the process of laying out a data structure in a series of bits. Here, we’re not concerned about how/whether the data gets written out to the disk, but are rather concerned with the order in which things will get laid out, and how they should be “de-serialized”. For example, a Point object might get laid out as three co-ordinates: m_x, m_y and m_z (all floats). Serialization doesn’t really care if they are finally written out to the disk straight as 12 bytes total, or are written out as XML. It is only concerned with the order. During serialization, the Save and Load functions of the objects usually get called. The serialization mechanism can also used for cloning, or to issue RPCs, such as in SOAP.

    Persistence: Also known as archiving (as in BOOST). It is the process of actually writing (or reading) the streamed data to disk. This process deals more with “how” the data gets converted to bytes. For example, writing to an IStorage would be provided by a different persistence engine than writing to an ADP file. Similarly, writing to an XML or simple ASCII is dictated by the particular persistence mechanism used.

  • 相关阅读:
    线段树(单点更新) HDOJ 2795 Billboard
    线段树(单点更新) HDU 1754 I Hate It
    线段树(单点更新)/树状数组 HDOJ 1166 敌兵布阵
    递推DP URAL 1031 Railway Tickets
    记忆化搜索(DFS+DP) URAL 1223 Chernobyl’ Eagle on a Roof
    递推DP URAL 1244 Gentlemen
    DFS水题 URAL 1152 False Mirrors
    记忆化搜索(DFS+DP) URAL 1501 Sense of Beauty
    DP+高精度 URAL 1036 Lucky Tickets
    DP/最短路 URAL 1741 Communication Fiend
  • 原文地址:https://www.cnblogs.com/taoxu0903/p/1929932.html
Copyright © 2011-2022 走看看