best practices for globals/identifiers in a Cocoa app
best practices for globals/identifiers in a Cocoa app
- Subject: best practices for globals/identifiers in a Cocoa app
- From: John Clayton <email@hidden>
- Date: Sun, 09 Nov 2003 19:50:42 -0500
Hi,
When using strings and such as identifiers, especially when tying into
interface elements like a table column name, or in user defaults as
keys, etc., I have been in the practice of doing something like this:
MyClass.h
extern NSString * myIdent ;
MyClass.m
NSString* myIdent = @"the_name_of_something";
and then using the variable in place of the actual string.
This works fine, except that the amount of these things is growing
rather large and keeping them in my app delegate like I have been doing
seems cumbersome. Is there an acceptable way to keep them in a
separate file? I was thinking maybe a protocol that the client class
would implement and gain access to these variables, but unsure of the
implications of that. It seems a waste to declare a class just for
its fields.
I've looked through our list carefully and found some hints, but
nothing definitive. Doing a revue of open source Cocoa code now to try
and learn a few tricks, like an old dog.
Well, anyway, thanks ;-)
John
-----------------------------------------------------------
No clever signature goes unpunished.
-----------------------------------------------------------
_______________________________________________
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.