Re: Java vs. Objective-C for Cocoa
Re: Java vs. Objective-C for Cocoa
- Subject: Re: Java vs. Objective-C for Cocoa
- From: Ondra Cada <email@hidden>
- Date: Sun, 24 Apr 2005 00:38:32 +0200
Jonathon,
On 23.4.2005, at 23:53, Jonathon Mah wrote:
Of course the tool can easily find in the NIB that "doThis:" is
sent(*). How on earth though would it know whether the actual
receiver is an instance of the former class, or an instance of the
latter one?
It asks you. You say yes or no and it does its stuff, saving you a lot
of time.
I respectfully doubt the conclusion.
Since you would in a number of cases check the code anyway, I am pretty
convinced it would not save any time worth speaking of, if compared
with a regexp search&replace, which, after all, does this too.
I do know there are cases when a "smart" re-factoring tool can do more
than regexp, that's without any doubts.
What I am trying to point out though is that, in ObjC/Cocoa typical
code, there is a little number of them and a vast majority of those
Yes/No cases -- such a vast majority the "smart" tool actually does not
help at all. What about those typeless containers? Although the code I
just sent to Marcel is in my estimate the most common one, an
alternative of
for (id en=[array objectEnumerator],id foo;foo=[en nextObject];) [foo
whatever];
would be, I fear, quite often used too. I would even dare say a
theoretically improper (but perfectly functional) code of kind
...
NSString *s=[en nextObject];
if (![s isKindOfClass:[NSString class]]) s=[s description];
...
would be pretty common in ObjC!
These are, I fear, *very common* cases the automat would bring more
problems that it would solve, since -- and again, do please correct me
if I am wrong -- the probability the code would be mistaken of what
actually happens, OR EVEN the programmer would be lead astray by a
false belief the automat "knows what it is doing", is pretty vast.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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