• 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: Ondra Cada <email@hidden>
  • Date: Tue, 2 May 2006 04:25:35 +0200

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]

should be changed or not. The best the tool can do here is to ask you what to do with this. What's even worse, ObjC uses "reflexion" more often than Java, and, of course, with reflexion no re-factoring tool can really help.

Now, the opinions may differ (!), but myself, I think the best thing available for a re-factoring with a dynamically typed language like Objective C is a good regexp find/replace tool (which we happen to have in Xcode, though it could be improved here and there).

Whilst there definitely is a thing or two which a smart re-factoring tool can do above the regexp f&r capabilities, I am biased against those smart re-factoring tools on the pretext that, given the above limitation, they would be pretty unreliable. What's worse, they would mislead the user to depend on them (namely a user who grown to rely on them in Java, like you)--and be seriously bitten in his bottom by the consequences.

In my personal opinion, Xcode team should put the effort into widening the regexp f&r functionality to NIBs. Whilst it kind-of works with textual NIB format, the integration is at best poor, and the convenience level is very bad.
---
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
  • Follow-Ups:
    • Re: Refactoring tools available for Cocoa / ObjC?
      • From: "Lawrence Sanbourne" <email@hidden>
References: 
 >Refactoring tools available for Cocoa / ObjC? (From: "Eric Lin" <email@hidden>)

  • Prev by Date: Re: Is there any overhead on hidden views?
  • Next by Date: Re: Refactoring tools available for Cocoa / ObjC?
  • Previous by thread: Refactoring tools available for Cocoa / ObjC?
  • Next by thread: Re: Refactoring tools available for Cocoa / ObjC?
  • Index(es):
    • Date
    • Thread