Re: How do I create a mutable version of my object?
Re: How do I create a mutable version of my object?
- Subject: Re: How do I create a mutable version of my object?
- From: Chris Hanson <email@hidden>
- Date: Mon, 20 Jan 2003 16:34:38 -0600
At 8:15 PM +0100 1/20/03, Jens Bauer wrote:
I'm afraid of the overhead of NSObject. If it contains too many
instance-variables, then it'll quickly grow huge. On the other hand,
if NSObject already knows how to "repeat" a subclass (which I think
might be difficult for NSObject), it would only add the overhead
once.
Uh, what? It sounds like you're doing *very* premature optimization
here *and* you don't understand how classes and instances are
implemented in Objective-C.
An instance of NSObject currently has a single instance variable,
isa, that points to the object's class. Any instance of a subclass
Foo of NSObject will have that instance variable, as well as any
instance variables defined by Foo. Any instance of a subclass Bar of
Foo will have isa from NSObject, any instance variables defined by
Foo, and any instance variables defined by Bar.
There are two things you need to do:
(1) Read "The Objective-C Programming Language" in the developer
documentation, so you understand the Objective-C language, both how
to use it and how it works behind the scenes.
(2) Remember the rules of optimization: Get the code working 100%,
determine if performance needs improving, then *measure* where your
performance is going and address the areas your *measurement*
indicates in priority order.
-- Chris
--
Chris Hanson, bDistributed.com, Inc. | Email: email@hidden
Custom Application Development | Phone: +1-847-372-3955
http://bdistributed.com/ | Fax: +1-847-589-3738
http://bdistributed.com/Articles/ | Personal Email: email@hidden
_______________________________________________
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.