• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Refactoring tools available for Cocoa / ObjC?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Refactoring tools available for Cocoa / ObjC?


  • Subject: Re: Refactoring tools available for Cocoa / ObjC?
  • From: Scott Ellsworth <email@hidden>
  • Date: Tue, 2 May 2006 10:27:37 -0700


On May 1, 2006, at 8:18 PM, Lawrence Sanbourne wrote:

On 5/1/06, Ondra Cada <email@hidden> wrote:
Eric,

On 2.5.2006, at 3:21, Eric Lin wrote:

> Coming from Eclipse / Java, I've been spoiled by the ability to rename
> any identifier in my code (class, method, variable) and have the IDE
> automatically (and reliably) replaces all occurrences of the
> identifier through my code. This enable me to prototype my code
> quickly and refractor later. Unfortunately, I couldn't seem to find
> any equivalent technology for Cocoa / Obj C. Is there a reason for
> this? Does Obj-C's loose-typing affect this somehow?


Definitely.

Assume you want refactor -[MyClass intValue] to -[MyClass longValue].
Whilst a smart re-factoring tool can point out and change a number of
cases like

MyClass *o;
...
[o intValue];

there is absolutely no way for it to determine whether

[[someArray objectAtIndex:0] intValue]

Although I agree that this would create problems for a refactoring tool, why does it need to be all-or-nothing? Even just being able to rename classes would be fantastic, and I don't think that would present (m)any problems with Objective-C's loose typing. Could be wrong, though.

I would find renaming/retyping/changing signature of methods much more useful, as that is ilkely to be a problem with a simple regex.


In a tool like IDEA or Eclipse, if I change an instance variable's type from, say, double to int, it changes the accessor methods, then brings up the usages for me to change as needed. If I change the name, then, from getCount to getCardinality, or some such, then only those usages of getCount that actually come from an object of that type get found. Further, because of the strong typing, it can actually _find_ the vast majority of usages.

This is much harder in objc, given that valueForKeyPath:@"thing.count" is not just perfectly valid, it is common. Thus, finding the 'count' calls that refer to just my 'UglyTreeMap' class is a non trivial problem. Would be nice if it could, though.

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


References: 
 >Refactoring tools available for Cocoa / ObjC? (From: "Eric Lin" <email@hidden>)
 >Re: Refactoring tools available for Cocoa / ObjC? (From: Ondra Cada <email@hidden>)
 >Re: Refactoring tools available for Cocoa / ObjC? (From: "Lawrence Sanbourne" <email@hidden>)

  • Prev by Date: Re: Newbe Question: Searching Address Book
  • Next by Date: Re: Newbe Question: Searching Address Book
  • Previous by thread: Re: Refactoring tools available for Cocoa / ObjC?
  • Next by thread: Re: Refactoring tools available for Cocoa / ObjC?
  • Index(es):
    • Date
    • Thread