Page 1 of 1
Serialization pitfalls
Posted: Wed Jul 21, 2010 11:01 am
by greyhoundcode
I love the idea of serializing objects, storing them on a database, then bringing them back to life. It seems a very convenient way, for instance, of storing application settings within an object, particularly as opposed to .ini files or XML: but are there performance or other issues to be wary of with this approach?
Re: Serialization pitfalls
Posted: Wed Jul 21, 2010 11:43 am
by Weirdan
One obvious problem: by storing a complex structure in a single field you're violating 1NF and prevent yourself from querying on particular values in that complex structure.
Re: Serialization pitfalls
Posted: Wed Jul 21, 2010 11:53 am
by greyhoundcode
I see what you're saying, but in terms of facilitating a persistent object are there any other workable options?
Re: Serialization pitfalls
Posted: Wed Jul 21, 2010 3:32 pm
by Weirdan
For arbitrary objects - no, not really (short of using document-oriented databases like CouchDB or MongoDB). However if you have a fixed object class you can use any of available ORM solutions to map objects to table rows (in the simplest case).
Re: Serialization pitfalls
Posted: Wed Jul 21, 2010 3:48 pm
by greyhoundcode
Good advice as always, thanks.