Re: Find the 'Application Support' folder
Re: Find the 'Application Support' folder
- Subject: Re: Find the 'Application Support' folder
- From: John Stiles <email@hidden>
- Date: Mon, 18 Oct 2004 09:03:50 -0700
Well, sure, your code example 1 looks better than 2, because it doesn't
do the same thing! :) Not every Cocoa call in the world [[[can stack]
like] this] although I agree it's cool when it works.
My advice to you would be to make Carbon-to-Cocoa wrapper functions
when you need them, and use categories to put them in the classes where
you need them, so you can keep [[[[[coding things] all] on] one] line].
Personally, while I've found that style very convenient on some
occasions, I frequently find that I need to use the whole width of my
Cinema display to write code that actually does something useful :) so
I end up breaking things up a lot anyway.
On Oct 17, 2004, at 4:31 PM, Greg Hurrell wrote:
El 12/10/2004, a las 18:40, John Stiles escribió:
On Oct 12, 2004, at 9:21 AM, Charles Srstka wrote:
FSFindFolder works, but I have always wondered why Apple hasn't
built in a Cocoa API for accessing these folders. Having to go
through Carbon to do this is kind of annoying.
Yes, there are third-party categories that give this functionality,
but it really should be part of the default API.
I've never understood this attitude. I must be missing something,
because to me it feels elitist.
Nothing to do with elitism. Everything to do with code readability and
consistency.
A pageful of pure Objective-C method invocations is much easier to
read than the same slab interspersed with C-style function calls.
Here's a contrived example to show the contrast; personally I find the
first version much easier to read:
// version 1: nothing but Objective-C selectors:
[[[instance method1] method2] method3];
// version 2: Objective-C selectors mixed in with C-style function
calls:
result1 = [instance method1];
thing result2;
FunctionCall(result1, &result2);
if (result2)
[result2 method3];
For that reason, if I generally write wrappers for any such function
calls, if it's likely that I'll use them often. That way all the
procedural/functional ugliness is encapsulated away, out of sight.
Cheers,
Greg
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden