Questions tagged [serialization]
Serialization is the process of converting an object into a stream of bytes in order to persist it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed.
140 questions
18votes
5answers
4kviews
Why should I never ever ever use Java serialization?
I've heard that I should never use Java serialization (Serializable/ObjectInputStream/ObjectOutputStream) because of security. What's the problem?
1vote
3answers
237views
Code generation for multi-platform, multi-language library
I need to design a code generator system that produces serialisation/deserialisation libraries for multiple languages running on multiple platforms. Hard Constraints I need this to capture a pre-...
4votes
3answers
1kviews
Does it make sense to to abstract serialization/deserialization?
Serialization and deserialization in .NET applications can be achieved using several libraries, e.g. Newtonsoft.Json System.Text.Json Assuming I'm developing a new application where I want to use ...
2votes
2answers
166views
How to protect class invariants when using the extraction operator?
The C++ "standard" method for serializing and deserializing a data type is to use streams with the insertion (<<) and extraction (>>) operators. This has some flaws, but it does ...
3votes
2answers
233views
Serializing key-values vs array of options
Is there a reason to encode options like this: { "options":[ { "name":"opt1", "value":"val1", }, { ...
2votes
1answer
136views
Encoding hierarchy information in objects
I am writing code that will assign entities to transaction. Each transaction has a counterparty entity. Requirements The entities should be (de-)serialisable (from pydantic models into JSON and vice ...
11votes
5answers
4kviews
How do you fix the wrong-case-sensitivity dictionary setting bug-pattern?
There is a coding anti-pattern I've noticed (while using .Net). You declare a data class, which is supposed to have a dictionary field (or get/set Property), and lets call it 'Properties', for the ...
17votes
10answers
7kviews
Should serialization and deserialization be "atomic" transactions?
I am wondering if serialization and deserialization of classes should always be treated as an "atomic transaction?" What I mean is, if an error were to occur during the process of ...
1vote
3answers
219views
Using source code instead of XML/JSON or other custom serialization schemes and binary file formats
For a while now I have been toying with the idea of using source code as a file storage format. My question: How to support format version changes? (loading of older files with structural differences) ...
1vote
1answer
507views
Should serializable classes have different serialization versions?
I am distributing a proprietary library that includes multiple serializable classes (serializable to a file). I want versioning to the serializable classes, i.e. when serializing I put the version ...
1vote
2answers
137views
What do you call a process which transforms objects of complex types into simple objects of primitive types? [closed]
My first thought was that I'm "serializing" the complex object, but from what I understand that means I'm reducing it down to a string or binary format which could be passed over a network. ...
0votes
2answers
472views
Deserialization and routing of objects
I know this question has to have been answered in countless ways before, but I would appreciate some help pointing me in the correct direction. I am developing an embedded system that receives "...
1vote
1answer
169views
Programs running under Slurm for > 24 hours are being killed by process management. What are good approaches in Python to work around this issue? [closed]
I often run data processing/machine learning/filesystem-scanning scripts that can take well over 24 hours to complete. For processes with arbitrarily low memory requirements, I can run without using ...
1vote
1answer
890views
Memento pattern for Undo/Redo AND Save/Load with multiple objects
In a pretty big project, I have a hierarchy of objects, let's say: Zone object, which contains Block objects and Connection objects. Mainliy, the Connection object links together several Block objects,...
1vote
1answer
612views
Dealing with business logic on DTOs using a DDD
I have a scenario in which an Entity defines an EntityRepresentation that is created from another end. The EntityRepresentation is a value object that implements some logic that should be performed on ...