Re: static vs non-static. Recommendation needed.
Re: static vs non-static. Recommendation needed.
- Subject: Re: static vs non-static. Recommendation needed.
- From: Тимофей Даньшин <email@hidden>
- Date: Mon, 13 Apr 2009 16:28:22 +0400
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?
Well, not exactly, i suppose. The point is that i create DatabaseInfo
either before creating a new database or after opening an existing
one. In both cases the object is used to show the user some general
information about the currently open db, and in the former case, it is
also used to actually create the database.
I think i'll stick to Quincey Morris's suggestion.
And again thank you all for the help.
Timofey.
On Apr 13, 2009, at 3:59 PM, Gregory Weston wrote:
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
_______________________________________________
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