OeufsDePie / FAQt

FAQt (Frequently Asked Questions about Qt)
0 stars 0 forks source link

Saving workspaces, scenes and objects in general #3

Open mpizenberg opened 9 years ago

mpizenberg commented 9 years ago

I have search a bit about how to serialize objects in order to save them in files. It seems that there are two main options :

Apparently both types have advantages and inconvenients. I would like to have your opinion and/or preferences. Below I recap advantages and disadvantages of both according to me.

JSON

Advantages :

Disavantages :

Advantages :

Disadvantages :

fabiencastan commented 9 years ago

I recommend json for the file format. Using pickle automatically store your objects. It's great to create disk cache for example, but not a good solution for a file format because it's difficult to deal with compatibility issues, etc. It's more interesting to find the right representation and then convert that to your objects in memory instead of trying to directly pickle your objects.