Re: Two Small Suggestions



Blair,


The reason it works as it does is because if you rename at any other
scope than global then you may not be carrying out a behaviour
preserving refactoring. Contrary to intuition it should actually be
safer to rename at global scope (ignoring external dependencies such as
stuff saved in binary filed images), because you shouldn't break
anything.


The problem, though, lies with polymorphic message sends. For example,
I renamed a method which I had called #at:put to #atChild:put (which I
later reversed), and the refactoring agent renamed #at:put everywhere in
the class. As a result, <objectNodeMap at: put:> was renamed to
<objectNodeMap atChild: put:>, except that #at:put in this case came
from a variant of Dictionary, not my class, nor was it the target of my
refactoring. Fortunately, I had selected "Class" as the scope, not
something broader.

As you point out, too narrow a scope could break the refactoring (which
I have also experienced). But it seems that too broad a scope could
break the image. Perhaps showing a checkable list of changes about to
be made before committing the refactoring would be a good middle ground.
I have seen this in other IDEs in the context of find-and-replace, and
it would seem to be consistent with Dolphin's design paradigm (e.g.
showing a list of dependencies when attempting to delete a variable,
etc.).

But I do like Chris's "F2" suggestion, as well as the edit-in-place
(EIP) suggestion. EIP would be consistent with Dolphin's approach to
renaming variables.

Since this suggestion is probably a matter of taste, I think Ian's
approach of making a minor change in the image is acceptable. Or
perhaps it could be relegated to a user preference.

Cheers,

Eric


-----Original Message-----
From: Blair McGlashan [mailto:blairmcg@xxxxxxxxxxxxxxx]
Posted At: Friday, June 23, 2006 10:17 AM
Posted To: comp.lang.smalltalk.dolphin
Conversation: Two Small Suggestions
Subject: Re: Two Small Suggestions

"Ian Bartholomew" <news@xxxxxxxxxxx> wrote in message
news:4fsa2lF1kfa4lU1@xxxxxxxxxxxxxxxxx
Eric,

1) When renaming a method using "Refactorings" from the context
menu,
it
might be safer to set the default scope to something a little less
destructive than "Global," perhaps "Class" or "Method".
[]
Any thoughts?

I would agree, Global is probably my least favourable option as well
-
although I would prefer to use Package as the default choice. If
you
want
to change the default then you can edit the method
RBScopedMethodName>>defaultScope or add an #onViewOpened method to
the
RenameMethodDialog class (cleaner but takes a bit more work).


The reason it works as it does is because if you rename at any other
scope
than global then you may not be carrying out a behaviour preserving
refactoring. Contrary to intuition it should actually be safer to
rename
at
global scope (ignoring external dependencies such as stuff saved in
binary
filed images), because you shouldn't break anything.

I think Chris suggested ages ago that an F2 rename of a method (or
perhaps
a
click-on-already-selected initiated rename) should result in an
in-place
rename that would work only at method scope. This seems sensible to me
(there would be a one-off warning message that you might be about to
break
something by renaming an individual method).

Regards

Blair


.



Relevant Pages

  • Re: Two Small Suggestions
    ... Global is probably my least favourable option as well - ... The reason it works as it does is because if you rename at any other scope ... Contrary to intuition it should actually be safer to rename at ...
    (comp.lang.smalltalk.dolphin)
  • Re: Newbie question on renaming
    ... > do (guessing because I've never used one). ... > to get Emacs to rename a variable, ... in a very limited scope, inside a function or in a let body. ...
    (comp.lang.lisp)
  • Re: After a few days with VS.NET 2005
    ... It's called "RENAME" under refactoring. ... see a class in a concise manner like you could in C++, Delphi, etc. ... and not because the Delphi language requires ...
    (borland.public.delphi.non-technical)
  • Re: For Loops and Variables
    ... significance extend over wider spans. ... what category fits loop indices? ... for half a thousand consider refactoring. ... I can understand the scope thing. ...
    (comp.lang.java.programmer)
  • Re: Delphi 2006... The Beast! The Best !
    ... > I've used both "Rename" and ... > "Extract Method" in this proof of concept console app I dreamed up that as ... this is the big draw of refactoring. ... having to worry about mistakes. ...
    (borland.public.delphi.non-technical)