Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Instantiation



> Here's a general question. When should I instantiate, and when
> should I not?

You should instantiate when you need an instance. You shouldn't when you
don't.;>

Seriously, other than UI objects (which are instantiated by dragging them
onto the window) and controllers, I tend to instantiate rarely. One thing
I've done is instantiate a custom formatter and then hook it up to numerous
textfields' formatter outlets. That way the fields each share the same
formatter, which may save a little memory but mostly saves me the pain of
attaching formatters in some more labor-intensive way.

> Is an instantiated object necessarily a controller?

No. See above. I seem to remember that someone made an IB Palette to
instantiate dictionaries and arrays, but I never used it.

> Should I even *have*
> that many instatiations in a nib?

I like my nibs clean, and I haven't seen very compelling reasons to
instantiate a lot of other objects, but I'm sure there are a lot of
different points of view on this topic. I'd be interested in hearing about
what other people do; maybe I'm working harder than I should.

Jonathan
_______________________________________________
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: 
 >Instantiation (From: Will Oram <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.