Re: Category or Protocol? (sidetrack)
Re: Category or Protocol? (sidetrack)
- Subject: Re: Category or Protocol? (sidetrack)
- From: Scott Ellsworth <email@hidden>
- Date: Wed, 20 Apr 2005 16:15:01 -0700
On Apr 20, 2005, at 3:45 PM, Ondra Cada wrote:
Rick,
On 21.4.2005, at 0:25, Rick Kitts wrote:
I would suggest that the issues you're describing say far less
about objc than they do about the tool. I feel that XCode is
approximately 4 years behind, say, IntelliJ for java.
Well I do not know IntelliJ, but...
Much of what I do at work (e.g. rename a method that is called
from literally 1000 locations in 300 files) I would never attempt
with XCode or any other non-smart tool.
.. presumed this kind of task is ever needed (and, having
maintained nearly million-line projects for years, I've never
bumped into one yet!),
Turning a block of code into a method, replacing similar code with
that method call, renaming methods or classes to support a new
design, etc. are things that I do all the time, because they are
simple operations with a refactoring editor. With XCode, this has to
be done semi-manually.
note that XCode supports a full-fledged regexp search&replace. You
just cannot get a better and more flexible tool for such things.
I find that tools which understand the meaning of the code are better
than syntactic tools. IDEA understands the AST of the Java code, and
can thus move things based on context. For example, if I rename
Foobar.thingie, or decide to split Foobar into an interface and two
concrete subclasses, IDEA makes sure that _every_ usage of the
appropriate methods and fields gets done right.
Put another way, I would have a hard time writing the regex to rename
and reorder the Joebob method:
addThingie:theThingie toSomething:theSomething withBlobs:blobs
into
turnSomething:theSomething intoThingie:theThingie usingBlobs:blobs,
given that usages might be something like:
[joebob addThingie:[which where] toSomething:[[Victim alloc]
initWithJoe:joe] withBlobs:nil];
and there might be a
addThingie:toSomething:withBlobs: method in the LeapScreaming class,
which I do not want to rename. This is likely, in fact, as such a
name collision is one of the first signs that I have two different
things going on with the same name.
Another case: moving the field "akbar" into a subclass, and getting
all of the methods that refer to it. IDEA can tell me exactly how
akbar is used, and give me a list of the changes needed to bring this
about. This makes it really easy to move code around to match my
changing awareness of the ideal design.
In other words, if I decide to wrap "foo" into a getter/setter, I do
not have to figure out all the places that "foo" is used - I need
only decide that I want it moved, and the editor takes care of the
grunt work. Sure, I _can_ do it manually, but I would rather let a
computer do things that are repetitive and mechanical.
XCode does work pretty well, but I do find I miss refactoring
goodies. They automate tedium, and let me concentrate on the meat of
the code.
Scott
_______________________________________________
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