Hmmm - (again if you can please be patient with me)... I really am
missing something big here?
So in my example class X and Y are subclasses of WAComponent - which
has tons of subclasses (it could be even worse, they could subclass
Object?). So does this mean that I should create my superclass A first?
E.g. I create a new subclass of WAComponent, called A. I then make X
and Y subclass A. Now I can do the "Refactor Class | Create Subclass"
refactoring, and so I have to call it A2 (ultimately I only want A -
but if needs must). Then I do get the prompt that you are referring to
and can select both X and Y. Finally it just offers to make me class
A2 but unlike what I was trying below it doesn't offer to move up any
methods or instance variables????
So this doesn't work? And furthermore it seem much more convoluted
than it should be?
I don't understand why Refactor Class | Create Superclass doesn't
prompt me for other peer classes (this is what I want - in fact what I
really, really want is to select 2 classes in the first place).
Maybe I'm being really stupid, or does no-one use this refactoring in
Pharo? It would seem that my scenario is a very common one - so I'm
struggling with this. And frustratingly it seems that all the
horsepower to do this, is built into the tools but they just don't use
them in an intuitive way?
Tim
On 6 Aug 2010, at 11:18, Lukas Renggli wrote:
Select the superclass of your classes X and Y and perform the 'create
subclass' refactoring. A dialog asks you to choose the subclasses of
your new class.
This old website describes most of the refactorings:
http://st-www.cs.illinois.edu/users/brant/Refactory/Refactorings.html.
There is also a description in the tooltips of the menu actions.
Lukas
On 6 August 2010 11:47, Tim Mackinnon <[email protected]> wrote:
Hi Lukas - sorry to keep this thread going, but I don't quite
understand
what you mean? Partly I think the issue is that over the years I've
become
very familiar with the Eclipse/IntelliJ refactorings (and how they
approach
things) and I've slowly forgotten how they work in smalltalk
(although - in
Dolphin they seem to more closely match Eclipse/IntelliJ - adding
to my
confusion in Pharo).
To give some context, I had a class X, then I copied it to create
class Y -
made some changes and got something useful working. However X and Y
are
mostly the same - so deserve a superclass. This sounds to me like
standard
Refactor Class | Create Superclass refactoring (available in the
context
menu). Is this what you are referring to? (And this is a seaside30.rc
image). Is this the create class refactoring you are referring to? It
doesn't sound like it?
The one I am referring to just asks me for a name of a superclass
and shows
me the method changes it will make (and I can remove those which I
don't
deem common) - but they only apply to the single class I ran the
refactoring
for - say X. This then leaves me with Y which still needs work. I
was
expecting somewhere where it would ask me if there are any other
classes to
consider for the refactoring (or better still - let me multi-select
several
classes before I do the "create superclass" in the first place -
which
apparently is very hard in Pharo for some reason?).
So is there some other browser, or menu option that I am missing?
Tim
On 6 Aug 2010, at 00:31, Lukas Renggli wrote:
Good point. I've been struggling with multiple selection too
e.g. when
setting the refactoring scope. There's an entry called
"selection..."
but
since I've never been able to select more than one item from a
list,
selecting "selection..." has the same effect as “category" (when
in a
category list of course).
So is there some way of applying a refactoring to more than one
class?
What
is that refactoring scope menu item - is there some way to
specify 2 or
more
classes in there? Why is this so hard?
The refactoring scope is something completely different. It selects
the part of the system that is considered by a refactoring.
Did you ever try to go through the whole create-class refactoring? I
get a dialog that offers me to select multiple classes.
Lukas
--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project