FROM : John Stiles
DATE : Mon Oct 18 18:03:50 2004
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_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
DATE : Mon Oct 18 18:03:50 2004
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_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| Peter Karlsson | Oct 9, 16:38 | |
| Sherm Pendley | Oct 9, 17:34 | |
| David Reed | Oct 9, 17:57 | |
| Finlay Dobbie | Oct 9, 18:11 | |
| Steven Kramer | Oct 10, 22:38 | |
| Sean McBride | Oct 12, 02:40 | |
| Charles Srstka | Oct 12, 18:21 | |
| John Stiles | Oct 12, 18:40 | |
| stephane sudre | Oct 12, 19:04 | |
| John Stiles | Oct 12, 19:36 | |
| Rosyna | Oct 12, 20:43 | |
| Greg Hurrell | Oct 18, 01:31 | |
| John Stiles | Oct 18, 18:03 |






Cocoa mail archive

