|Dec 18, 2011, 04:09 PM||#1|
Encoding vs Array and Dictionary
I'm currently being introduced slowly to encoding in Objective C, and I have a fundamental question to ask.
Why would an Object orientated programmer want to encode an object to the file system, instead of create an array or dictionary of objects?
I know there's a sensible answer to this, so please don't think I'm contesting the logic of it.
|Dec 18, 2011, 06:51 PM||#4|
|Dec 19, 2011, 12:55 AM||#5|
If the complementary -decodeWithCoder: methods are written correctly, NSKeyedUnarchiver can restore the entire object graph using the data object that was archived. This technique allows a much richer and more complex structure to be saved and restored easily and efficiently than you might be able to do with an array or dictionary. Once decoded, you program state is essentially fully restored to what it was when you saved it (except, usually, without the undo stack).
If you look at the documentation for NSArray or NSDictionary, you will see that there are strict limitations on what they can write to a file; encoding lets you get around these limitations.
Mr. Paul, sir, I thought you should be advised, there seems to be a zombie tribble clinging to your head, for it is scarfing your brain
|array, dictionary, encoding, objective|
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Objective C Help - Encoding||nashyo||Mac Programming||25||Dec 21, 2011 11:51 AM|
|Array and Dictionary||naphatkrit||iPhone/iPad Programming||2||Aug 7, 2011 10:49 PM|
|How to integrate a SearchBar from an Array of Dictionaries||Nekbeth||iPhone/iPad Programming||1||Mar 28, 2011 02:25 PM|
|An Array Of Dictionaries Not Writing To File Correctly?||Darkroom||iPhone/iPad Programming||6||Aug 29, 2009 11:22 AM|
|Filtering an array with dictionary objects||Farani||iPhone/iPad Programming||0||Nov 8, 2008 02:59 PM|
All times are GMT -5. The time now is 09:26 AM.