|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
Program Design and documentation using Key-Value coding
I don't know any coding practices, model designs and documentation standards that address Key-Value coding properly, but maybe there is and I've missed it.
Standard UML lists members and methods but how do you handle the planning of possible keys for members that are dictionaries of key-value pairs? .h files with method prototypes makes documenting the purpose and the way to use a class easy, with the exception of key-value based methods. Is there a recommended way and place to document the key-value behaviour of a class in the .h file? Is there a best practice standard for documenting key-value properties when used with cocoa bindings?
__________________
Someone get Nekkid™, now! |
|
|
|
0
|
|
|
#2 |
|
I presume you mean aside from the setter/getter methods a class may have?
|
|
|
|
0
|
|
|
#3 |
|
Yes, I mean if a class has a member for instance like this:
- (NSMutableDictionary*) properties; - (void) setProperties:(NSMutableDictionary*)p;
__________________
Someone get Nekkid™, now! |
|
|
|
0
|
|
|
#4 |
|
I don't think so. AFAIK the convention of stuffing a class's properties into a dictionary is not an Apple/NeXT one. I can't recall seeing it done that way in any official Apple code, I think they prefer the separate setter/getter methods.
__________________
Go outside, the graphics are amazing! |
|
|
|
0
|
|
|
#5 | |
|
Quote:
__________________
Someone get Nekkid™, now! |
||
|
|
0
|
|
|
#6 |
|
...or indeed the print system which relies on a dictionary (NSPrintInfo).
In short, to answer your question....I dunno. If you find an answer let me know (other than commenting a like hell in the .h file). Other tricky questions...how do you document a .nib with a ton of bindings in it? |
|
|
|
0
|
|
|
#7 | |
|
Quote:
We didn't learn about these kinds of things in CS. That's why I'm asking. Do the Cocoa programming books have anything to say about this? Have anyone here read them?
__________________
Someone get Nekkid™, now! |
||
|
|
0
|
|
|
#8 | |
|
Quote:
|
||
|
|
0
|
|
|
#9 | |
|
Quote:
__________________
Go outside, the graphics are amazing! |
||
|
|
0
|
|
|
#10 | |
|
Quote:
I can't remember having seen Apple using mutable property dictionaries, though. But there's a Cocoa Bindings tutorial over at CocoaDevCentral that can give some explaination why you see it in a bunch of third-party code. That's the place I got the idea of using property dictionaries with cocoa bindings. It's very convenient, but I see some documentation and maintainability problems with the practice.
__________________
Someone get Nekkid™, now! |
||
|
|
0
|
|
|
#11 |
|
Here's my coding practices when I'm using hashtables (c++ / c / c#):
If the number and content of the keys can be known at compile time, I usually stuff them in the class containing the hashtable. If the number cannot be known, but the format is, I create a method that outputs a key. Here's a c# sample: PHP Code:
|
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| Core Data and Key-Value Coding | gormster | Mac Programming | 2 | Jan 31, 2010 07:12 AM |
| Can someone make me and app using the code? | bob5731 | Wasteland | 3 | Aug 5, 2009 08:39 PM |
| Key-Value Coding ....a perspective please | mdeh | Mac Programming | 4 | Mar 24, 2009 10:33 PM |
| Key-Value Coding and Encapsulation | MacRohde | Mac Programming | 5 | Jun 26, 2007 06:48 PM |
| Key-Value Coding Question | Soulstorm | Mac Programming | 4 | Feb 13, 2007 05:53 PM |
All times are GMT -5. The time now is 12:13 AM.






Linear Mode

