• 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: static vs non-static. Recommendation needed.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: static vs non-static. Recommendation needed.


  • Subject: Re: static vs non-static. Recommendation needed.
  • From: Gregory Weston <email@hidden>
  • Date: Mon, 13 Apr 2009 07:59:12 -0400

ok5.admin wrote:

Hello.
A foreword:
In my application I need to allow the user to create a database. So i
display a dialogue panel, collect all the necessary information about
the db to be created and create a "DatabaseInfo" object. Then i pass
that DatabaseInfo object to the DatabaseCreator to actually create the
needed database. I want the DatabaseCreator to "return" an sqlite3
pointer.

...

Is it all right to init an object just to dealloc it in the next line
(or create an autorelease object using a convenience method for that
matter)? I mean, if i made it non-static, i would have something like
this in the class that uses it:

DatabaseCreator *dbc = [DatabaseCreator creatorWithDBInfo: dbInfo];
sqlite3* database = [dbc database]; // and dbc would no longer be used.


Or is it better to put up with the inconveniences of having that thing
static?

It's better to follow the practice that you'll find most maintainable.

But I might suggest you've omitted a couple of options. Would it be, for example, particularly evil if your DatabaseInfo object include a createDatabase method?
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: static vs non-static. Recommendation needed.
      • From: Тимофей Даньшин <email@hidden>
  • Prev by Date: Re: How to open two nibs at app launch ? Beginners question
  • Next by Date: Re: static vs non-static. Recommendation needed.
  • Previous by thread: Re: static vs non-static. Recommendation needed.
  • Next by thread: Re: static vs non-static. Recommendation needed.
  • Index(es):
    • Date
    • Thread