Re: Question about the Foundation Framework
Re: Question about the Foundation Framework
- Subject: Re: Question about the Foundation Framework
- From: Sherm Pendley <email@hidden>
- Date: Thu, 19 Feb 2009 10:45:35 -0500
On Thu, Feb 19, 2009 at 10:36 AM, Michael Ash <email@hidden> wrote:
> On Thu, Feb 19, 2009 at 9:15 AM, Michael <email@hidden> wrote:
> > My question, having seen that the author creates and then stores these
> > unique names in the NSTemporaryDirectory, is **why** one would choose
> that
> > directory over, say, some locally created directory..is there a good OOP
> > reason for choosing that Foundation directory? Unless I have missed
> > something, ( quite probably) the documentation does not specifically
> discuss
> > this aspect...but if it does...I will gladly read that if available.
>
> Nothing to do with OOP, it's just good practice on the system.
> Temporary files go in the temporary directory. There are several
> reasons why this is a good idea:
>
> - The temporary directory gets cleaned out regularly by the system. If
> you forget to delete the file or your app crashes or something else
> like that goes wrong, your temporary file won't sit around on the
> user's HD forever taking up space.
>
> - It's hidden and out of the way, so users aren't bothered by seeing
> temporary files they don't care about pop up in their home directory
> somewhere.
>
> - It's local even when the home directory itself is not. For example,
> if the user's home directory is stored on a network server, it's
> wasteful to put temporary files on that network server too when
> they're only needed locally.
And, of course, there's a very good meta-reason - you gain all of the above
benefits without having to write, debug, or maintain the relevant code
yourself. Apple already wrote it, so why reinvent that wheel?
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________
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