Headline

Serialize companies

Description

Company data must be serializable so that data is preserved also during downtimes of the system:Company. Any serialization format is conceivable here. Serialized data would be typically stored in the file system between program runs.

Motivation

Programming languages differ in terms of serialization approaches in interesting ways. In addition, multiple reasonable serialization options may exist for even the same language.

Illustration

One reasonable serialization format is Language:JSON. The typical sample company is represented in Language:JSON as follows:

{ 
  "name" : "Acme Corporation",
  "departments" : [
    {
      "name" : "Research",
      "manager" : {
        "name" : "Fred",
        "salary" : 88888
      }   
    },
    {
      "name" : "Development",
      "manager" : {
        "name" : "Marie",
        "salary" : 77777
      },
      "departments" : [
        {
          "name" : "Dev1",
          "manager" : {
            "name" : "Bob",
            "salary" : 77776
          }
        },
        {
          "name" : "Dev2",
          "manager" : {
            "name" : "Alice",
            "salary" : 77775
          },
          "employees" : [
            {
              "name" : "Ralf",
              "salary" : 4711
            }
          ]
        }
      ]
    }
  ]
}

Various languages blend well with Language:JSON as serialization format. For instance, Language:Python provides library support to serialize Language:Python's dictionaries in Language:JSON. For instance, in the following code, the load method of a Language:JSON API is used to deserialize on-file Language:JSON content.

company = json.load(open(sys.argv[1], 'r'))

The snippet originates from Contribution:pyjson.

Relationships

Guidelines

  • This is an abstract (an XOR) feature, which should not be chosen as such, but instead either Feature:Open serialization or Feature:Closed serialization is to be selected.
  • A suitable demonstration of serialization should deserialize company data so that the "resurrected" company can be processed, e.g., by totaling salaries according to Feature:Total. Also, round-tripping of serialization should be demonstrated such that serialization of given data following by de-serialization returns the same data.

Metadata


johanneshaertel edited this article at Fri, 30 Jun 2017 15:43:40 +0200
Compare revisions Compare revisions

User contributions

    This user never has never made submissions.

    User edits

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.

    10 most similar pages:

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.