You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Krüger, Olaf <OK...@edscha.com> on 2013/07/17 15:35:49 UTC

OT: Persistence of data objects by using serialization

Hi,
this is a bit off topic, but I ask myself this question very often. Maybe someone asks the same.

What do you think about serialization of AS3 data objects (e.g. an ArrayCollaction) to persist the data in an easy way?

For instance there's an ArrayCollection that contains hierarchical data that we have to persist.
We could simply pass it to the backend, serialize the object and store it e.g. as BLOB inside a database field.
This is very easy and fast to implement.
The other conventional way is to be using nested sets or similar ideas to describe the hierarchical structure inside the database.
But this means much more effort at the backend.

So my general question is:
Is it evil to serialize an object only to persist it?
What are the pros and cons?

Many thanks in advance,
Olaf


________________________________

Edscha Holding GmbH
Sitz der Gesellschaft: Remscheid
Registergericht: Wuppertal, HRB 22889
Geschäftsführung: Francisco J. Riberas Mera, Juan Maria Riberas Mera, Francisco López Peña, David Vázquez Pascual, Torsten Greiner, Mario Eikelmann, Hans-Peter Schulz und Volker Weiss

Vertretungsberechtigt sind nur Geschäftsführer und schriftlich Bevollmächtigte.

Solely Managing Directors or employees with a written proxy have got power of representation.

Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung, Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System. Vielen Dank.

The contents of this e-mail including any attachments are confidential and may be legally privileged. If you are not the intended recipient, any disclosure, copying, distribution or use of its contents is strictly prohibited, and you should please notify the sender immediately and then delete this e-mail including any attachments from your system. Thank you.

Re: OT: Persistence of data objects by using serialization

Posted by Tom Chiverton <tc...@extravision.com>.
On 17/07/2013 14:35, Krüger, Olaf wrote:
> What are the pros and cons?
Briefly,
If it's now just a blob of text in the database, if you ever need to do 
anything with it server side, it will be a world of pain.
But, converting to/from a proper server-side representation can be time 
consuming and error prone.

Tom

AW: OT: Persistence of data objects by using serialization

Posted by "christofer.dutz@c-ware.de" <ch...@c-ware.de>.
Hey ... why did my mail Client just send this mail without me being finished? ;-)
https://dev.c-ware.de/confluence/display/PUBLIC/High+speed+object+storage+for+complex+models+using+JPA+and+Adobe-AMF

Chris

________________________________________
Von: christofer.dutz@c-ware.de [christofer.dutz@c-ware.de]
Gesendet: Donnerstag, 18. Juli 2013 13:23
An: users@flex.apache.org
Betreff: AW: OT: Persistence of data objects by using serialization

In one Project I used AMF for serialization in the DB ... the cool Thing about this, was that we were actually able to add new attributes to our objects without corrupting the serialized data (Ok ... renaming and removing of attributes is bad, but the AMF serialization has proven to be way more robust than other approaches ;-)


________________________________________
Von: Cosma Colanicchia [cosmacol@gmail.com]
Gesendet: Donnerstag, 18. Juli 2013 11:22
An: users@flex.apache.org
Betreff: Re: OT: Persistence of data objects by using serialization

Also, serialization by its nature tend to be very coupled with runtime
model of the objects - shoud your objects structure change in the future
(e.g. modify the object attributes), you may have troubles trying to
gracefully reuse or migrate the old serialized data.

You can mitigate this to some extent properly using the [Transient]
metadata, or you can take full control using custom serialization
(implementing the IExternalizable interface) at the expense of writing your
read/write logic (but this could kill the advantage over a traditional
persistence management).



2013/7/18 Krüger, Olaf <OK...@edscha.com>

> >The question always comes back to "do we need to search/edit the data on
> the server?"
>
> Yes, it seems that this is the central question that must be answered
> before storing serialized objects on the server.
>
> Thanks,
> Olaf
>
> ________________________________
>
> Edscha Holding GmbH
> Sitz der Gesellschaft: Remscheid
> Registergericht: Wuppertal, HRB 22889
> Geschäftsführung: Francisco J. Riberas Mera, Juan Maria Riberas Mera,
> Francisco López Peña, David Vázquez Pascual, Torsten Greiner, Mario
> Eikelmann, Hans-Peter Schulz und Volker Weiss
>
> Vertretungsberechtigt sind nur Geschäftsführer und schriftlich
> Bevollmächtigte.
>
> Solely Managing Directors or employees with a written proxy have got power
> of representation.
>
> Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist
> vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der
> bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung,
> Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte
> informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie
> die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System.
> Vielen Dank.
>
> The contents of this e-mail including any attachments are confidential and
> may be legally privileged. If you are not the intended recipient, any
> disclosure, copying, distribution or use of its contents is strictly
> prohibited, and you should please notify the sender immediately and then
> delete this e-mail including any attachments from your system. Thank you.
>

AW: OT: Persistence of data objects by using serialization

Posted by "christofer.dutz@c-ware.de" <ch...@c-ware.de>.
In one Project I used AMF for serialization in the DB ... the cool Thing about this, was that we were actually able to add new attributes to our objects without corrupting the serialized data (Ok ... renaming and removing of attributes is bad, but the AMF serialization has proven to be way more robust than other approaches ;-)


________________________________________
Von: Cosma Colanicchia [cosmacol@gmail.com]
Gesendet: Donnerstag, 18. Juli 2013 11:22
An: users@flex.apache.org
Betreff: Re: OT: Persistence of data objects by using serialization

Also, serialization by its nature tend to be very coupled with runtime
model of the objects - shoud your objects structure change in the future
(e.g. modify the object attributes), you may have troubles trying to
gracefully reuse or migrate the old serialized data.

You can mitigate this to some extent properly using the [Transient]
metadata, or you can take full control using custom serialization
(implementing the IExternalizable interface) at the expense of writing your
read/write logic (but this could kill the advantage over a traditional
persistence management).



2013/7/18 Krüger, Olaf <OK...@edscha.com>

> >The question always comes back to "do we need to search/edit the data on
> the server?"
>
> Yes, it seems that this is the central question that must be answered
> before storing serialized objects on the server.
>
> Thanks,
> Olaf
>
> ________________________________
>
> Edscha Holding GmbH
> Sitz der Gesellschaft: Remscheid
> Registergericht: Wuppertal, HRB 22889
> Geschäftsführung: Francisco J. Riberas Mera, Juan Maria Riberas Mera,
> Francisco López Peña, David Vázquez Pascual, Torsten Greiner, Mario
> Eikelmann, Hans-Peter Schulz und Volker Weiss
>
> Vertretungsberechtigt sind nur Geschäftsführer und schriftlich
> Bevollmächtigte.
>
> Solely Managing Directors or employees with a written proxy have got power
> of representation.
>
> Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist
> vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der
> bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung,
> Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte
> informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie
> die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System.
> Vielen Dank.
>
> The contents of this e-mail including any attachments are confidential and
> may be legally privileged. If you are not the intended recipient, any
> disclosure, copying, distribution or use of its contents is strictly
> prohibited, and you should please notify the sender immediately and then
> delete this e-mail including any attachments from your system. Thank you.
>

AW: OT: Persistence of data objects by using serialization

Posted by Krüger, Olaf <OK...@edscha.com>.
>Also, serialization by its nature tend to be very coupled with runtime model of the objects - shoud your objects structure change in the future (e.g. modify the object attributes), you may have troubles trying to >gracefully reuse or migrate the old serialized data.

You're right, but if object attributes change it may be not so much effort to migrate the serialized data to the new structure.
Of course this migration(s) in summary should be much less effort than using a traditional persistence management.




________________________________

Edscha Holding GmbH
Sitz der Gesellschaft: Remscheid
Registergericht: Wuppertal, HRB 22889
Geschäftsführung: Francisco J. Riberas Mera, Juan Maria Riberas Mera, Francisco López Peña, David Vázquez Pascual, Torsten Greiner, Mario Eikelmann, Hans-Peter Schulz und Volker Weiss

Vertretungsberechtigt sind nur Geschäftsführer und schriftlich Bevollmächtigte.

Solely Managing Directors or employees with a written proxy have got power of representation.

Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung, Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System. Vielen Dank.

The contents of this e-mail including any attachments are confidential and may be legally privileged. If you are not the intended recipient, any disclosure, copying, distribution or use of its contents is strictly prohibited, and you should please notify the sender immediately and then delete this e-mail including any attachments from your system. Thank you.

Re: OT: Persistence of data objects by using serialization

Posted by Cosma Colanicchia <co...@gmail.com>.
Also, serialization by its nature tend to be very coupled with runtime
model of the objects - shoud your objects structure change in the future
(e.g. modify the object attributes), you may have troubles trying to
gracefully reuse or migrate the old serialized data.

You can mitigate this to some extent properly using the [Transient]
metadata, or you can take full control using custom serialization
(implementing the IExternalizable interface) at the expense of writing your
read/write logic (but this could kill the advantage over a traditional
persistence management).



2013/7/18 Krüger, Olaf <OK...@edscha.com>

> >The question always comes back to "do we need to search/edit the data on
> the server?"
>
> Yes, it seems that this is the central question that must be answered
> before storing serialized objects on the server.
>
> Thanks,
> Olaf
>
> ________________________________
>
> Edscha Holding GmbH
> Sitz der Gesellschaft: Remscheid
> Registergericht: Wuppertal, HRB 22889
> Geschäftsführung: Francisco J. Riberas Mera, Juan Maria Riberas Mera,
> Francisco López Peña, David Vázquez Pascual, Torsten Greiner, Mario
> Eikelmann, Hans-Peter Schulz und Volker Weiss
>
> Vertretungsberechtigt sind nur Geschäftsführer und schriftlich
> Bevollmächtigte.
>
> Solely Managing Directors or employees with a written proxy have got power
> of representation.
>
> Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist
> vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der
> bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung,
> Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte
> informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie
> die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System.
> Vielen Dank.
>
> The contents of this e-mail including any attachments are confidential and
> may be legally privileged. If you are not the intended recipient, any
> disclosure, copying, distribution or use of its contents is strictly
> prohibited, and you should please notify the sender immediately and then
> delete this e-mail including any attachments from your system. Thank you.
>

AW: OT: Persistence of data objects by using serialization

Posted by Krüger, Olaf <OK...@edscha.com>.
>The question always comes back to "do we need to search/edit the data on the server?"

Yes, it seems that this is the central question that must be answered before storing serialized objects on the server.

Thanks,
Olaf

________________________________

Edscha Holding GmbH
Sitz der Gesellschaft: Remscheid
Registergericht: Wuppertal, HRB 22889
Geschäftsführung: Francisco J. Riberas Mera, Juan Maria Riberas Mera, Francisco López Peña, David Vázquez Pascual, Torsten Greiner, Mario Eikelmann, Hans-Peter Schulz und Volker Weiss

Vertretungsberechtigt sind nur Geschäftsführer und schriftlich Bevollmächtigte.

Solely Managing Directors or employees with a written proxy have got power of representation.

Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung, Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System. Vielen Dank.

The contents of this e-mail including any attachments are confidential and may be legally privileged. If you are not the intended recipient, any disclosure, copying, distribution or use of its contents is strictly prohibited, and you should please notify the sender immediately and then delete this e-mail including any attachments from your system. Thank you.

Re: OT: Persistence of data objects by using serialization

Posted by Jonathan Campos <jo...@gmail.com>.
On Wed, Jul 17, 2013 at 8:35 AM, Krüger, Olaf <OK...@edscha.com> wrote:

> So my general question is:
> Is it evil to serialize an object only to persist it?
> What are the pros and cons?
>

In various projects we've come across this. Sometimes we've just shoved it
in there. Sometimes we parsed the hell out of it to fit in various tables.
The question always comes back to "do we need to search/edit the data on
the server?"

Remember that hierarchical schemas are a very real and accepted form of
storage... most people just know them as XML.

-- 
Jonathan Campos