pharo-users@lists.pharo.org

Any question about pharo is welcome

View all threads

[ANN] class-diff: a new tool for comparing classes

HM
Hernán Morales Durand
Mon, Jul 22, 2024 6:57 AM

Dear Pharo community,

I am happy to present a new tool designed specifically for comparing
classes in Pharo. It provides a two-sided list of methods, so you can
quickly understand the relationships between two classes.

The project location is on GitHub:

https://github.com/hernanmd/class-diff

Feel free to send comments and contributions via PRs.
Have a great day,

Hernán

Dear Pharo community, I am happy to present a new tool designed specifically for comparing classes in Pharo. It provides a two-sided list of methods, so you can quickly understand the relationships between two classes. The project location is on GitHub: https://github.com/hernanmd/class-diff Feel free to send comments and contributions via PRs. Have a great day, Hernán
TM
Tim Mackinnon
Mon, Jul 22, 2024 4:08 PM

This looks interesting, and I will definitely check it out.

As a small side query - i've noticed a few times now that people are giving load instructions like :
EpMonitor disableDuring: [
Metacello new

I understand that this de-clutters the work history, so its much easier track real changes - however why isn't there an extension on Metacello in Pharo, that does this automatically - e.g.  #loadWithoutLogging ?

Then everyones instructions could be much cleaner - and this extension might also do something clever to log that you loaded a baseline - but not show all the code loaded?

I'm curuious on this - and possibly its PR we should submit?

Tim

On Mon, 22 Jul 2024, at 7:57 AM, Hernán Morales Durand wrote:

Dear Pharo community,

I am happy to present a new tool designed specifically for comparing classes in Pharo. It provides a two-sided list of methods, so you can quickly understand the relationships between two classes.

The project location is on GitHub:

https://github.com/hernanmd/class-diff

Feel free to send comments and contributions via PRs.
Have a great day,

Hernán

This looks interesting, and I will definitely check it out. As a small side query - i've noticed a few times now that people are giving load instructions like : EpMonitor disableDuring: [ Metacello new I understand that this de-clutters the work history, so its much easier track real changes - however why isn't there an extension on Metacello in Pharo, that does this automatically - e.g. #loadWithoutLogging ? Then everyones instructions could be much cleaner - and this extension might also do something clever to log that you loaded a baseline - but not show all the code loaded? I'm curuious on this - and possibly its PR we should submit? Tim On Mon, 22 Jul 2024, at 7:57 AM, Hernán Morales Durand wrote: > Dear Pharo community, > > I am happy to present a new tool designed specifically for comparing classes in Pharo. It provides a two-sided list of methods, so you can quickly understand the relationships between two classes. > > The project location is on GitHub: > > https://github.com/hernanmd/class-diff > > Feel free to send comments and contributions via PRs. > Have a great day, > > Hernán >
RO
Richard O'Keefe
Tue, Jul 23, 2024 10:30 AM

That's a very nice tool.  There are two tweaks I'd like to see.
Two classes having methods with the same name isn't the same as two
classes having the same method.
When the two classes have a method with the same name, there are at
least three possibilities:

  • The methods are the same method

  • The methods are different, but the name is defined in some common
    superclass, so they had better be related methods.

  • The methods are completely unrelated, like #next in ReadStream and LIFOQueue.

The third case applies to every method.  Perhaps the best way
therefore is to show
something in the header, like

(score) diff of descendants of <nearest common superclass>
<column> <column>

The first and second cases are the ones I want to tell apart so that I
don't spend any time looking
for differences that aren't there.

What's the best way to learn how to use Spec2?

On Mon, 22 Jul 2024 at 18:58, Hernán Morales Durand
hernan.morales@gmail.com wrote:

Dear Pharo community,

I am happy to present a new tool designed specifically for comparing classes in Pharo. It provides a two-sided list of methods, so you can quickly understand the relationships between two classes.

The project location is on GitHub:

https://github.com/hernanmd/class-diff

Feel free to send comments and contributions via PRs.
Have a great day,

Hernán

That's a very nice tool. There are two tweaks I'd like to see. Two classes having methods with the same *name* isn't the same as two classes having the same *method*. When the two classes have a method with the same name, there are at least three possibilities: - The methods are the same method - The methods are different, but the name is defined in some common superclass, so they had better be related methods. - The methods are completely unrelated, like #next in ReadStream and LIFOQueue. The third case applies to every method. Perhaps the best way therefore is to show something in the header, like (score) diff of descendants of <nearest common superclass> <column> <column> The first and second cases are the ones I want to tell apart so that I don't spend any time looking for differences that aren't there. What's the best way to learn how to use Spec2? On Mon, 22 Jul 2024 at 18:58, Hernán Morales Durand <hernan.morales@gmail.com> wrote: > > Dear Pharo community, > > I am happy to present a new tool designed specifically for comparing classes in Pharo. It provides a two-sided list of methods, so you can quickly understand the relationships between two classes. > > The project location is on GitHub: > > https://github.com/hernanmd/class-diff > > Feel free to send comments and contributions via PRs. > Have a great day, > > Hernán >
HM
Hernán Morales Durand
Tue, Jul 23, 2024 11:37 AM

Thanks for your nice feedback Richard, I will sketch something and see how
it goes.

About learning Spec2, for me, the best resource is to directly use the
image examples. In the main menu, you have "Help -> Spec 2 demo" and "Help
-> Spec 2 examples". And you also have the book in
https://github.com/SquareBracketAssociates

Hernán

El mar, 23 jul 2024 a las 10:30, Richard O'Keefe (raoknz@gmail.com)
escribió:

That's a very nice tool.  There are two tweaks I'd like to see.
Two classes having methods with the same name isn't the same as two
classes having the same method.
When the two classes have a method with the same name, there are at
least three possibilities:

  • The methods are the same method

  • The methods are different, but the name is defined in some common
    superclass, so they had better be related methods.

  • The methods are completely unrelated, like #next in ReadStream and
    LIFOQueue.

The third case applies to every method.  Perhaps the best way
therefore is to show
something in the header, like

(score) diff of descendants of <nearest common superclass>
<column> <column>

The first and second cases are the ones I want to tell apart so that I
don't spend any time looking
for differences that aren't there.

What's the best way to learn how to use Spec2?

On Mon, 22 Jul 2024 at 18:58, Hernán Morales Durand
hernan.morales@gmail.com wrote:

Dear Pharo community,

I am happy to present a new tool designed specifically for comparing

classes in Pharo. It provides a two-sided list of methods, so you can
quickly understand the relationships between two classes.

The project location is on GitHub:

https://github.com/hernanmd/class-diff

Feel free to send comments and contributions via PRs.
Have a great day,

Hernán

Thanks for your nice feedback Richard, I will sketch something and see how it goes. About learning Spec2, for me, the best resource is to directly use the image examples. In the main menu, you have "Help -> Spec 2 demo" and "Help -> Spec 2 examples". And you also have the book in https://github.com/SquareBracketAssociates Hernán El mar, 23 jul 2024 a las 10:30, Richard O'Keefe (<raoknz@gmail.com>) escribió: > That's a very nice tool. There are two tweaks I'd like to see. > Two classes having methods with the same *name* isn't the same as two > classes having the same *method*. > When the two classes have a method with the same name, there are at > least three possibilities: > > - The methods are the same method > > - The methods are different, but the name is defined in some common > superclass, so they had better be related methods. > > - The methods are completely unrelated, like #next in ReadStream and > LIFOQueue. > > The third case applies to every method. Perhaps the best way > therefore is to show > something in the header, like > > (score) diff of descendants of <nearest common superclass> > <column> <column> > > The first and second cases are the ones I want to tell apart so that I > don't spend any time looking > for differences that aren't there. > > What's the best way to learn how to use Spec2? > > On Mon, 22 Jul 2024 at 18:58, Hernán Morales Durand > <hernan.morales@gmail.com> wrote: > > > > Dear Pharo community, > > > > I am happy to present a new tool designed specifically for comparing > classes in Pharo. It provides a two-sided list of methods, so you can > quickly understand the relationships between two classes. > > > > The project location is on GitHub: > > > > https://github.com/hernanmd/class-diff > > > > Feel free to send comments and contributions via PRs. > > Have a great day, > > > > Hernán > > >
HM
Hernán Morales Durand
Tue, Jul 23, 2024 2:55 PM

Hi Tim,

I know Guille has been working with Metacello issues, but I don't know if
specifically on this.
But for me, it is correct that by default package loading is not logged by
Epicea.
Let me know if you open an issue and I will take a look.

Hernán

El lun, 22 jul 2024 a las 16:08, Tim Mackinnon (tim@testit.works)
escribió:

This looks interesting, and I will definitely check it out.

As a small side query - i've noticed a few times now that people are
giving load instructions like :

EpMonitor disableDuring: [
Metacello new

I understand that this de-clutters the work history, so its much easier
track real changes - however why isn't there an extension on Metacello in
Pharo, that does this automatically - e.g.  #loadWithoutLogging ?

Then everyones instructions could be much cleaner - and this extension
might also do something clever to log that you loaded a baseline - but not
show all the code loaded?

I'm curuious on this - and possibly its PR we should submit?

Tim

On Mon, 22 Jul 2024, at 7:57 AM, Hernán Morales Durand wrote:

Dear Pharo community,

I am happy to present a new tool designed specifically for comparing
classes in Pharo. It provides a two-sided list of methods, so you can
quickly understand the relationships between two classes.

The project location is on GitHub:

https://github.com/hernanmd/class-diff

Feel free to send comments and contributions via PRs.
Have a great day,

Hernán

Hi Tim, I know Guille has been working with Metacello issues, but I don't know if specifically on this. But for me, it is correct that by default package loading is not logged by Epicea. Let me know if you open an issue and I will take a look. Hernán El lun, 22 jul 2024 a las 16:08, Tim Mackinnon (<tim@testit.works>) escribió: > This looks interesting, and I will definitely check it out. > > As a small side query - i've noticed a few times now that people are > giving load instructions like : > > EpMonitor disableDuring: [ > Metacello new > > > I understand that this de-clutters the work history, so its much easier > track real changes - however why isn't there an extension on Metacello in > Pharo, that does this automatically - e.g. #loadWithoutLogging ? > > Then everyones instructions could be much cleaner - and this extension > might also do something clever to log that you loaded a baseline - but not > show all the code loaded? > > I'm curuious on this - and possibly its PR we should submit? > > Tim > > On Mon, 22 Jul 2024, at 7:57 AM, Hernán Morales Durand wrote: > > Dear Pharo community, > > I am happy to present a new tool designed specifically for comparing > classes in Pharo. It provides a two-sided list of methods, so you can > quickly understand the relationships between two classes. > > The project location is on GitHub: > > https://github.com/hernanmd/class-diff > > Feel free to send comments and contributions via PRs. > Have a great day, > > Hernán > > >
RO
Richard O'Keefe
Wed, Jul 24, 2024 2:06 AM

Thanks for the advice about Spec2.
I was keen to try Class-diff out, so I fired up Pharo, followed the
installation instructions with no problems, and then tried the
example.
The example got a run-time error, and I expect that it's because the
Pharo release I fired up was Pharo 9.

Which release(s) of Pharo is Class-diff intended to work with?

On Tue, 23 Jul 2024 at 23:38, Hernán Morales Durand
hernan.morales@gmail.com wrote:

Thanks for your nice feedback Richard, I will sketch something and see how it goes.

About learning Spec2, for me, the best resource is to directly use the image examples. In the main menu, you have "Help -> Spec 2 demo" and "Help -> Spec 2 examples". And you also have the book in https://github.com/SquareBracketAssociates

Hernán

El mar, 23 jul 2024 a las 10:30, Richard O'Keefe (raoknz@gmail.com) escribió:

That's a very nice tool.  There are two tweaks I'd like to see.
Two classes having methods with the same name isn't the same as two
classes having the same method.
When the two classes have a method with the same name, there are at
least three possibilities:

  • The methods are the same method

  • The methods are different, but the name is defined in some common
    superclass, so they had better be related methods.

  • The methods are completely unrelated, like #next in ReadStream and LIFOQueue.

The third case applies to every method.  Perhaps the best way
therefore is to show
something in the header, like

(score) diff of descendants of <nearest common superclass>
<column> <column>

The first and second cases are the ones I want to tell apart so that I
don't spend any time looking
for differences that aren't there.

What's the best way to learn how to use Spec2?

On Mon, 22 Jul 2024 at 18:58, Hernán Morales Durand
hernan.morales@gmail.com wrote:

Dear Pharo community,

I am happy to present a new tool designed specifically for comparing classes in Pharo. It provides a two-sided list of methods, so you can quickly understand the relationships between two classes.

The project location is on GitHub:

https://github.com/hernanmd/class-diff

Feel free to send comments and contributions via PRs.
Have a great day,

Hernán

Thanks for the advice about Spec2. I was keen to try Class-diff out, so I fired up Pharo, followed the installation instructions with no problems, and then tried the example. The example got a run-time error, and I expect that it's because the Pharo release I fired up was Pharo 9. Which release(s) of Pharo is Class-diff intended to work with? On Tue, 23 Jul 2024 at 23:38, Hernán Morales Durand <hernan.morales@gmail.com> wrote: > > > Thanks for your nice feedback Richard, I will sketch something and see how it goes. > > About learning Spec2, for me, the best resource is to directly use the image examples. In the main menu, you have "Help -> Spec 2 demo" and "Help -> Spec 2 examples". And you also have the book in https://github.com/SquareBracketAssociates > > Hernán > > > El mar, 23 jul 2024 a las 10:30, Richard O'Keefe (<raoknz@gmail.com>) escribió: >> >> That's a very nice tool. There are two tweaks I'd like to see. >> Two classes having methods with the same *name* isn't the same as two >> classes having the same *method*. >> When the two classes have a method with the same name, there are at >> least three possibilities: >> >> - The methods are the same method >> >> - The methods are different, but the name is defined in some common >> superclass, so they had better be related methods. >> >> - The methods are completely unrelated, like #next in ReadStream and LIFOQueue. >> >> The third case applies to every method. Perhaps the best way >> therefore is to show >> something in the header, like >> >> (score) diff of descendants of <nearest common superclass> >> <column> <column> >> >> The first and second cases are the ones I want to tell apart so that I >> don't spend any time looking >> for differences that aren't there. >> >> What's the best way to learn how to use Spec2? >> >> On Mon, 22 Jul 2024 at 18:58, Hernán Morales Durand >> <hernan.morales@gmail.com> wrote: >> > >> > Dear Pharo community, >> > >> > I am happy to present a new tool designed specifically for comparing classes in Pharo. It provides a two-sided list of methods, so you can quickly understand the relationships between two classes. >> > >> > The project location is on GitHub: >> > >> > https://github.com/hernanmd/class-diff >> > >> > Feel free to send comments and contributions via PRs. >> > Have a great day, >> > >> > Hernán >> >
SD
stephane ducasse
Wed, Jul 24, 2024 6:57 PM

Pharo 12 or 13 or 11

Pharo 9 is quite old

S

On 24 Jul 2024, at 04:06, Richard O'Keefe raoknz@gmail.com wrote:

Thanks for the advice about Spec2.
I was keen to try Class-diff out, so I fired up Pharo, followed the
installation instructions with no problems, and then tried the
example.
The example got a run-time error, and I expect that it's because the
Pharo release I fired up was Pharo 9.

Which release(s) of Pharo is Class-diff intended to work with?

On Tue, 23 Jul 2024 at 23:38, Hernán Morales Durand
hernan.morales@gmail.com wrote:

Thanks for your nice feedback Richard, I will sketch something and see how it goes.

About learning Spec2, for me, the best resource is to directly use the image examples. In the main menu, you have "Help -> Spec 2 demo" and "Help -> Spec 2 examples". And you also have the book in https://github.com/SquareBracketAssociates

Hernán

El mar, 23 jul 2024 a las 10:30, Richard O'Keefe (raoknz@gmail.com) escribió:

That's a very nice tool.  There are two tweaks I'd like to see.
Two classes having methods with the same name isn't the same as two
classes having the same method.
When the two classes have a method with the same name, there are at
least three possibilities:

  • The methods are the same method

  • The methods are different, but the name is defined in some common
    superclass, so they had better be related methods.

  • The methods are completely unrelated, like #next in ReadStream and LIFOQueue.

The third case applies to every method.  Perhaps the best way
therefore is to show
something in the header, like

(score) diff of descendants of <nearest common superclass>
<column> <column>

The first and second cases are the ones I want to tell apart so that I
don't spend any time looking
for differences that aren't there.

What's the best way to learn how to use Spec2?

On Mon, 22 Jul 2024 at 18:58, Hernán Morales Durand
hernan.morales@gmail.com wrote:

Dear Pharo community,

I am happy to present a new tool designed specifically for comparing classes in Pharo. It provides a two-sided list of methods, so you can quickly understand the relationships between two classes.

The project location is on GitHub:

https://github.com/hernanmd/class-diff

Feel free to send comments and contributions via PRs.
Have a great day,

Hernán

Stéphane Ducasse
http://stephane.ducasse.free.fr
06 30 93 66 73

"If you knew today was your last day on earth, what would you do differently? ....ESPECIALLY if, by doing something different, today might not be your last day on earth.” Calvin & Hobbes

Pharo 12 or 13 or 11 Pharo 9 is quite old S > On 24 Jul 2024, at 04:06, Richard O'Keefe <raoknz@gmail.com> wrote: > > Thanks for the advice about Spec2. > I was keen to try Class-diff out, so I fired up Pharo, followed the > installation instructions with no problems, and then tried the > example. > The example got a run-time error, and I expect that it's because the > Pharo release I fired up was Pharo 9. > > Which release(s) of Pharo is Class-diff intended to work with? > > On Tue, 23 Jul 2024 at 23:38, Hernán Morales Durand > <hernan.morales@gmail.com> wrote: >> >> >> Thanks for your nice feedback Richard, I will sketch something and see how it goes. >> >> About learning Spec2, for me, the best resource is to directly use the image examples. In the main menu, you have "Help -> Spec 2 demo" and "Help -> Spec 2 examples". And you also have the book in https://github.com/SquareBracketAssociates >> >> Hernán >> >> >> El mar, 23 jul 2024 a las 10:30, Richard O'Keefe (<raoknz@gmail.com>) escribió: >>> >>> That's a very nice tool. There are two tweaks I'd like to see. >>> Two classes having methods with the same *name* isn't the same as two >>> classes having the same *method*. >>> When the two classes have a method with the same name, there are at >>> least three possibilities: >>> >>> - The methods are the same method >>> >>> - The methods are different, but the name is defined in some common >>> superclass, so they had better be related methods. >>> >>> - The methods are completely unrelated, like #next in ReadStream and LIFOQueue. >>> >>> The third case applies to every method. Perhaps the best way >>> therefore is to show >>> something in the header, like >>> >>> (score) diff of descendants of <nearest common superclass> >>> <column> <column> >>> >>> The first and second cases are the ones I want to tell apart so that I >>> don't spend any time looking >>> for differences that aren't there. >>> >>> What's the best way to learn how to use Spec2? >>> >>> On Mon, 22 Jul 2024 at 18:58, Hernán Morales Durand >>> <hernan.morales@gmail.com> wrote: >>>> >>>> Dear Pharo community, >>>> >>>> I am happy to present a new tool designed specifically for comparing classes in Pharo. It provides a two-sided list of methods, so you can quickly understand the relationships between two classes. >>>> >>>> The project location is on GitHub: >>>> >>>> https://github.com/hernanmd/class-diff >>>> >>>> Feel free to send comments and contributions via PRs. >>>> Have a great day, >>>> >>>> Hernán >>>> Stéphane Ducasse http://stephane.ducasse.free.fr 06 30 93 66 73 "If you knew today was your last day on earth, what would you do differently? ....ESPECIALLY if, by doing something different, today might not be your last day on earth.” Calvin & Hobbes
RO
Richard O'Keefe
Thu, Jul 25, 2024 1:19 PM

OK, so I tried Class-diff in Pharo 11.  I noticed two issues.
(1) I expected it to work like kdiff3, where scrolling scrolls both panes.
I'm so used to flying around differences using
Next/Previous/Last/First Difference buttons that I do very little
scrolling in kdiff3, but when I do scroll, it does its best to keep
the two panes aligned.
(2) Comparing Array and String, I eventually figured out that I was
being shown selectors defined in each class, but no selectors
inherited by a class.  For example, String canUnderstand: #asArray
but inherits it, so it's not shown in the String pain, while Array
defines it.  This looks like a "one class has it and the other lacks
it" case but it's *actually" a "both classes have it and it's
different in each", so a difference I'd really like to see.
I tracked this down to
self aligner
align: self sourceClass selectors sort
with: self targetClass selectors sort.
in updateAlignment,  Changing that to
self aligner
align: self sourceClass allSelectors asArray sort
with: self targetClass allSelectors asArray sort
got me closer to what I wanted, but then accessing the source code of
inherited methods didn't work because inherited methods, by
definition, aren't in the class's own method dictionary.  I could work
around that too, but it's 1:19 AM where I am.  In fact that's not
quite what I want anyway.  I don't want to be shown methods inherited
by both classes from Object (although methods inherited from Object
by one class and redefined or inherited from another class by the
other are ones I do want to see).

On Wed, 24 Jul 2024 at 14:06, Richard O'Keefe raoknz@gmail.com wrote:

Thanks for the advice about Spec2.
I was keen to try Class-diff out, so I fired up Pharo, followed the
installation instructions with no problems, and then tried the
example.
The example got a run-time error, and I expect that it's because the
Pharo release I fired up was Pharo 9.

Which release(s) of Pharo is Class-diff intended to work with?

On Tue, 23 Jul 2024 at 23:38, Hernán Morales Durand
hernan.morales@gmail.com wrote:

Thanks for your nice feedback Richard, I will sketch something and see how it goes.

About learning Spec2, for me, the best resource is to directly use the image examples. In the main menu, you have "Help -> Spec 2 demo" and "Help -> Spec 2 examples". And you also have the book in https://github.com/SquareBracketAssociates

Hernán

El mar, 23 jul 2024 a las 10:30, Richard O'Keefe (raoknz@gmail.com) escribió:

That's a very nice tool.  There are two tweaks I'd like to see.
Two classes having methods with the same name isn't the same as two
classes having the same method.
When the two classes have a method with the same name, there are at
least three possibilities:

  • The methods are the same method

  • The methods are different, but the name is defined in some common
    superclass, so they had better be related methods.

  • The methods are completely unrelated, like #next in ReadStream and LIFOQueue.

The third case applies to every method.  Perhaps the best way
therefore is to show
something in the header, like

(score) diff of descendants of <nearest common superclass>
<column> <column>

The first and second cases are the ones I want to tell apart so that I
don't spend any time looking
for differences that aren't there.

What's the best way to learn how to use Spec2?

On Mon, 22 Jul 2024 at 18:58, Hernán Morales Durand
hernan.morales@gmail.com wrote:

Dear Pharo community,

I am happy to present a new tool designed specifically for comparing classes in Pharo. It provides a two-sided list of methods, so you can quickly understand the relationships between two classes.

The project location is on GitHub:

https://github.com/hernanmd/class-diff

Feel free to send comments and contributions via PRs.
Have a great day,

Hernán

OK, so I tried Class-diff in Pharo 11. I noticed two issues. (1) I expected it to work like kdiff3, where scrolling scrolls both panes. I'm so used to flying around differences using Next/Previous/Last/First Difference buttons that I do very little scrolling in kdiff3, but when I do scroll, it does its best to keep the two panes aligned. (2) Comparing Array and String, I eventually figured out that I was being shown selectors *defined* in each class, but no selectors *inherited* by a class. For example, String canUnderstand: #asArray but inherits it, so it's not shown in the String pain, while Array defines it. This *looks* like a "one class has it and the other lacks it" case but it's *actually" a "both classes have it and it's different in each", so a difference I'd really like to see. I tracked this down to self aligner align: self sourceClass selectors sort with: self targetClass selectors sort. in updateAlignment, Changing that to self aligner align: self sourceClass allSelectors asArray sort with: self targetClass allSelectors asArray sort got me closer to what I wanted, but then accessing the source code of inherited methods didn't work because inherited methods, by definition, aren't in the class's own method dictionary. I could work around that too, but it's 1:19 AM where I am. In fact that's not quite what I want anyway. I don't want to be shown methods inherited by *both* classes from Object (although methods inherited from Object by one class and redefined or inherited from another class by the other are ones I do want to see). On Wed, 24 Jul 2024 at 14:06, Richard O'Keefe <raoknz@gmail.com> wrote: > > Thanks for the advice about Spec2. > I was keen to try Class-diff out, so I fired up Pharo, followed the > installation instructions with no problems, and then tried the > example. > The example got a run-time error, and I expect that it's because the > Pharo release I fired up was Pharo 9. > > Which release(s) of Pharo is Class-diff intended to work with? > > On Tue, 23 Jul 2024 at 23:38, Hernán Morales Durand > <hernan.morales@gmail.com> wrote: > > > > > > Thanks for your nice feedback Richard, I will sketch something and see how it goes. > > > > About learning Spec2, for me, the best resource is to directly use the image examples. In the main menu, you have "Help -> Spec 2 demo" and "Help -> Spec 2 examples". And you also have the book in https://github.com/SquareBracketAssociates > > > > Hernán > > > > > > El mar, 23 jul 2024 a las 10:30, Richard O'Keefe (<raoknz@gmail.com>) escribió: > >> > >> That's a very nice tool. There are two tweaks I'd like to see. > >> Two classes having methods with the same *name* isn't the same as two > >> classes having the same *method*. > >> When the two classes have a method with the same name, there are at > >> least three possibilities: > >> > >> - The methods are the same method > >> > >> - The methods are different, but the name is defined in some common > >> superclass, so they had better be related methods. > >> > >> - The methods are completely unrelated, like #next in ReadStream and LIFOQueue. > >> > >> The third case applies to every method. Perhaps the best way > >> therefore is to show > >> something in the header, like > >> > >> (score) diff of descendants of <nearest common superclass> > >> <column> <column> > >> > >> The first and second cases are the ones I want to tell apart so that I > >> don't spend any time looking > >> for differences that aren't there. > >> > >> What's the best way to learn how to use Spec2? > >> > >> On Mon, 22 Jul 2024 at 18:58, Hernán Morales Durand > >> <hernan.morales@gmail.com> wrote: > >> > > >> > Dear Pharo community, > >> > > >> > I am happy to present a new tool designed specifically for comparing classes in Pharo. It provides a two-sided list of methods, so you can quickly understand the relationships between two classes. > >> > > >> > The project location is on GitHub: > >> > > >> > https://github.com/hernanmd/class-diff > >> > > >> > Feel free to send comments and contributions via PRs. > >> > Have a great day, > >> > > >> > Hernán > >> >
TM
Tim Mackinnon
Thu, Jul 25, 2024 1:39 PM

Thats a great set of observations Richard - I think I'd want it to work like you have described too - probably showing an inherited method in a light grey to indicate its inherited (but dark enough so you can compare it to the one on the other side.

I could potentially forsee an option where you could "show all inherited" methods on both sides to check how close objects are (in this case, probably up to the point where the inheritance trees unite - for many thats object).

Another interesting (though experiment) option is to also show overriden methods and make space for things to keep lining up. Not totally sure on this - but thinking it might reveal accidental overrides or expose smells (again - just thinking aloud though).

There's lots of interesting room to explore things in this tool,

Tim

p.s. Agree on the scroll behaviour and also the jump to next.

On Thu, 25 Jul 2024, at 2:19 PM, Richard O'Keefe wrote:

OK, so I tried Class-diff in Pharo 11.  I noticed two issues.
(1) I expected it to work like kdiff3, where scrolling scrolls both panes.
I'm so used to flying around differences using
Next/Previous/Last/First Difference buttons that I do very little
scrolling in kdiff3, but when I do scroll, it does its best to keep
the two panes aligned.
(2) Comparing Array and String, I eventually figured out that I was
being shown selectors defined in each class, but no selectors
inherited by a class.  For example, String canUnderstand: #asArray
but inherits it, so it's not shown in the String pain, while Array
defines it.  This looks like a "one class has it and the other lacks
it" case but it's *actually" a "both classes have it and it's
different in each", so a difference I'd really like to see.
I tracked this down to
self aligner
align: self sourceClass selectors sort
with: self targetClass selectors sort.
in updateAlignment,  Changing that to
self aligner
align: self sourceClass allSelectors asArray sort
with: self targetClass allSelectors asArray sort
got me closer to what I wanted, but then accessing the source code of
inherited methods didn't work because inherited methods, by
definition, aren't in the class's own method dictionary.  I could work
around that too, but it's 1:19 AM where I am.  In fact that's not
quite what I want anyway.  I don't want to be shown methods inherited
by both classes from Object (although methods inherited from Object
by one class and redefined or inherited from another class by the
other are ones I do want to see).

On Wed, 24 Jul 2024 at 14:06, Richard O'Keefe raoknz@gmail.com wrote:

Thanks for the advice about Spec2.
I was keen to try Class-diff out, so I fired up Pharo, followed the
installation instructions with no problems, and then tried the
example.
The example got a run-time error, and I expect that it's because the
Pharo release I fired up was Pharo 9.

Which release(s) of Pharo is Class-diff intended to work with?

On Tue, 23 Jul 2024 at 23:38, Hernán Morales Durand
hernan.morales@gmail.com wrote:

Thanks for your nice feedback Richard, I will sketch something and see how it goes.

About learning Spec2, for me, the best resource is to directly use the image examples. In the main menu, you have "Help -> Spec 2 demo" and "Help -> Spec 2 examples". And you also have the book in https://github.com/SquareBracketAssociates

Hernán

El mar, 23 jul 2024 a las 10:30, Richard O'Keefe (raoknz@gmail.com) escribió:

That's a very nice tool.  There are two tweaks I'd like to see.
Two classes having methods with the same name isn't the same as two
classes having the same method.
When the two classes have a method with the same name, there are at
least three possibilities:

  • The methods are the same method

  • The methods are different, but the name is defined in some common
    superclass, so they had better be related methods.

  • The methods are completely unrelated, like #next in ReadStream and LIFOQueue.

The third case applies to every method.  Perhaps the best way
therefore is to show
something in the header, like

(score) diff of descendants of <nearest common superclass>
<column> <column>

The first and second cases are the ones I want to tell apart so that I
don't spend any time looking
for differences that aren't there.

What's the best way to learn how to use Spec2?

On Mon, 22 Jul 2024 at 18:58, Hernán Morales Durand
hernan.morales@gmail.com wrote:

Dear Pharo community,

I am happy to present a new tool designed specifically for comparing classes in Pharo. It provides a two-sided list of methods, so you can quickly understand the relationships between two classes.

The project location is on GitHub:

https://github.com/hernanmd/class-diff

Feel free to send comments and contributions via PRs.
Have a great day,

Hernán

Thats a great set of observations Richard - I think I'd want it to work like you have described too - probably showing an inherited method in a light grey to indicate its inherited (but dark enough so you can compare it to the one on the other side. I could potentially forsee an option where you could "show all inherited" methods on both sides to check how close objects are (in this case, probably up to the point where the inheritance trees unite - for many thats object). Another interesting (though experiment) option is to also show overriden methods and make space for things to keep lining up. Not totally sure on this - but thinking it might reveal accidental overrides or expose smells (again - just thinking aloud though). There's lots of interesting room to explore things in this tool, Tim p.s. Agree on the scroll behaviour and also the jump to next. On Thu, 25 Jul 2024, at 2:19 PM, Richard O'Keefe wrote: > OK, so I tried Class-diff in Pharo 11. I noticed two issues. > (1) I expected it to work like kdiff3, where scrolling scrolls both panes. > I'm so used to flying around differences using > Next/Previous/Last/First Difference buttons that I do very little > scrolling in kdiff3, but when I do scroll, it does its best to keep > the two panes aligned. > (2) Comparing Array and String, I eventually figured out that I was > being shown selectors *defined* in each class, but no selectors > *inherited* by a class. For example, String canUnderstand: #asArray > but inherits it, so it's not shown in the String pain, while Array > defines it. This *looks* like a "one class has it and the other lacks > it" case but it's *actually" a "both classes have it and it's > different in each", so a difference I'd really like to see. > I tracked this down to > self aligner > align: self sourceClass selectors sort > with: self targetClass selectors sort. > in updateAlignment, Changing that to > self aligner > align: self sourceClass allSelectors asArray sort > with: self targetClass allSelectors asArray sort > got me closer to what I wanted, but then accessing the source code of > inherited methods didn't work because inherited methods, by > definition, aren't in the class's own method dictionary. I could work > around that too, but it's 1:19 AM where I am. In fact that's not > quite what I want anyway. I don't want to be shown methods inherited > by *both* classes from Object (although methods inherited from Object > by one class and redefined or inherited from another class by the > other are ones I do want to see). > > On Wed, 24 Jul 2024 at 14:06, Richard O'Keefe <raoknz@gmail.com> wrote: >> >> Thanks for the advice about Spec2. >> I was keen to try Class-diff out, so I fired up Pharo, followed the >> installation instructions with no problems, and then tried the >> example. >> The example got a run-time error, and I expect that it's because the >> Pharo release I fired up was Pharo 9. >> >> Which release(s) of Pharo is Class-diff intended to work with? >> >> On Tue, 23 Jul 2024 at 23:38, Hernán Morales Durand >> <hernan.morales@gmail.com> wrote: >> > >> > >> > Thanks for your nice feedback Richard, I will sketch something and see how it goes. >> > >> > About learning Spec2, for me, the best resource is to directly use the image examples. In the main menu, you have "Help -> Spec 2 demo" and "Help -> Spec 2 examples". And you also have the book in https://github.com/SquareBracketAssociates >> > >> > Hernán >> > >> > >> > El mar, 23 jul 2024 a las 10:30, Richard O'Keefe (<raoknz@gmail.com>) escribió: >> >> >> >> That's a very nice tool. There are two tweaks I'd like to see. >> >> Two classes having methods with the same *name* isn't the same as two >> >> classes having the same *method*. >> >> When the two classes have a method with the same name, there are at >> >> least three possibilities: >> >> >> >> - The methods are the same method >> >> >> >> - The methods are different, but the name is defined in some common >> >> superclass, so they had better be related methods. >> >> >> >> - The methods are completely unrelated, like #next in ReadStream and LIFOQueue. >> >> >> >> The third case applies to every method. Perhaps the best way >> >> therefore is to show >> >> something in the header, like >> >> >> >> (score) diff of descendants of <nearest common superclass> >> >> <column> <column> >> >> >> >> The first and second cases are the ones I want to tell apart so that I >> >> don't spend any time looking >> >> for differences that aren't there. >> >> >> >> What's the best way to learn how to use Spec2? >> >> >> >> On Mon, 22 Jul 2024 at 18:58, Hernán Morales Durand >> >> <hernan.morales@gmail.com> wrote: >> >> > >> >> > Dear Pharo community, >> >> > >> >> > I am happy to present a new tool designed specifically for comparing classes in Pharo. It provides a two-sided list of methods, so you can quickly understand the relationships between two classes. >> >> > >> >> > The project location is on GitHub: >> >> > >> >> > https://github.com/hernanmd/class-diff >> >> > >> >> > Feel free to send comments and contributions via PRs. >> >> > Have a great day, >> >> > >> >> > Hernán >> >> >