• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Persistance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Persistance


  • Subject: Re: Persistance
  • From: Raphael Sebbe <email@hidden>
  • Date: Mon, 8 Oct 2001 20:09:12 +0200

You have 3 solutions actually (it seems to me I already said that about this ;-) :

1) implement NSCoding protocol for your objects, and use NSArchiver to actually store them. The advantages of this method is that it is easy to implement, has some nice features (versioning...). The drawback is that the file format is a proprietary binary one (Apple), and you won't be able to decode it from other platform/languages (unless you write your custom NSCoder subclass, but this is a fairly complex task).

2) use property lists to store your data
There, your objects can export themselves to NSDictionaries, composed of property list values only (NSArray, NSString, NSNumber...). You can then write the entire exported data to an XML property list. The advantage is a human readable format, portable. Drawback : everything is a string -> size.

3) custom file format. Like everywhere else.


I would go with 1) in your case, unless you plan to port your application on other platforms. In that case, I would go with 2).
Also note that there is an NSCoder subclass from a third party that stores objects as key-value pairs (mix of 1-2), but I can't remember where it comes from. Does anyone know ?

Raphael

On Monday, October 8, 2001, at 06:14 PM, Smith, Bradley wrote:

Apologies to John Tsombakos who I sent this to in error a few minutes ago
when it was meant to go to this list. Anyway...

Okay so I'm new to Cocoa. I'm working on a UML modelling tool - mostly to
learn Cocoa.
Now, in the olden days (C++) I'd see the job of persisting my model as my
job. Just another function I need to implement. These days however (Obj-C)
it appears that Cocoa *may* do that for me. I've read all about NSCoder etc.
but am still not sure what I need to do. I want to do it right you see. Any
pointer appreciated. Bear in mind that my model structure will constist of
any numer of classes, which - in turn - will contain any number of
operations etc. Also, my diagrams will refer to items in my model but will
also contain coordinate details to determine where they appear on the
diagram (2 different documents?).

What should I be doing? What's the first step?

<pointer for how technical the answer can be>
Just so you have an idea of my (in)competence: -

10 years programming, 5 years OO with C++, 5 minutes (well, a few weeks)
Obj-C and Cocoa.
Been through the Learning Cocoa book and was able to correct the (many)
mistakes as I went along.
</pointer for how technical the answer can be>

Many thanks in advance.

Brad
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


  • Follow-Ups:
    • Re: Persistance
      • From: Marcel Weiher <email@hidden>
References: 
 >Persistance (From: "Smith, Bradley" <email@hidden>)

  • Prev by Date: RE: Cocoa newbie frustration
  • Next by Date: Re: How to modify dialup number, login and password
  • Previous by thread: Re: Persistance
  • Next by thread: Re: Persistance
  • Index(es):
    • Date
    • Thread