Re: Simplifying this code?
Re: Simplifying this code?
- Subject: Re: Simplifying this code?
- From: Mario Diana <email@hidden>
- Date: Mon, 26 Jul 2004 20:39:04 -0400
On Monday, July 26, 2004, at 07:08 PM, Theodore H. Smith wrote:
Heres an interesting problem. How to simplify this kind of code.
I have a window, with lots of controls on it, textfields, switch
buttons, color panels, etc.
The state of this window, which is defined by the state of the
controls on the window, can be saved as a string, and loaded in from a
string.
[...]
Is there a better way??
Couldn't you model all of the state with a class, and then implement
the NSCoding protocol for that class?
Maybe I'm reading too much into this, and pardon me if I am, but it
seems like your design is a non-object-oriented way of doing things. I
wouldn't save the state of something as complex as a window with lots
of controls on it to a string. Wrap it all up in an object. Cocoa
provides a nice implementation for serializing ("archiving") objects,
and a collection object (like NSArray) implements this already.
Use the tools the framework provides, and venture not into the land of
unadulterated C. ;-)
(My 2 cents!)
Mario
=======================================================
Mario Diana Mobile: 845-380-8428
50 Forest Drive Home: 845-221-3989
Poughquag, NY 12570 Email: email@hidden
=======================================================
Programmer - Web development, Java, XML, LAMP, Mac OS X
=======================================================
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.