FROM : Ondra Cada
DATE : Sun Apr 24 00:38:32 2005
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_removed> http://www.ocs.cz
private <email_removed> http://www.ocs.cz/oc
DATE : Sun Apr 24 00:38:32 2005
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_removed> http://www.ocs.cz
private <email_removed> http://www.ocs.cz/oc






Cocoa mail archive

