• 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: Class generator script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Class generator script


  • Subject: Re: Class generator script
  • From: Ondra Cada <email@hidden>
  • Date: Mon, 3 May 2004 03:12:51 +0200

Adam,

On 3.5.2004, at 2:53, Adam wrote:

> Well, I am new to Obj-C and coming from Java

Beware the memory management. The retain/autorelease/release thing is
much better and more flexible than the Java GC, but at the same time
*much* more dangerous.

Learn class methods and categories: Java does not support well the
former and does not support at all the latter; both can allow you to
simplify your code *CONSIDERABLY*.

> I am used to a class for everything. I will briefly describe my
> design. If there is a better way I would like to know.
> I have a class "player" who needs to have a verity of properties
> associated with him NSString, int, bool, etc...
> I need to be able to dynamically create these objects as the app is
> running and new players join the server
> Then I add instances of the player object to an array so the
> properties can be displayed in an NSTableView.

It seems there is very little special Player functionality -- that you
would hardly write any other Player method than the accessors. Right?
If so, *do* use an NSMutableDictionary. Even if there happens to be a
simple Player-specific functionality, you would end with a less code
using a category to add it to the NSMutableDictionary class than doing
it all yourself.

Beware: in these situations, always use categories or object embedding;
never subclass NSDictionary (or NSArray or alike): they are class
clusters, which makes subclassing pretty difficult.
---
Ondra Hada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.


References: 
 >Class generator script (From: Adam <email@hidden>)
 >Re: Class generator script (From: Adam <email@hidden>)
 >Re: Class generator script (From: Ondra Cada <email@hidden>)
 >Re: Class generator script (From: Adam <email@hidden>)

  • Prev by Date: Re: Class generator script
  • Next by Date: Re: Message Notify
  • Previous by thread: Re: Class generator script
  • Next by thread: Re: Class generator script
  • Index(es):
    • Date
    • Thread