Re: [Pharo-users] How to view hierarchy of multiple classes in a package?
Changing ClassWidget>>#showHierarchy to: showHierarchy: aBoolean | all | (showHierarchy := aBoolean) ifFalse: [ ^ self ]. all := IdentitySet new. model selectedPackageGroup asNautilusSelection classes do: [ :cls | all addAll: cls allSuperclasses; addAll: cls withAllSubclasses ]. self cachedHierarchy: (SortHierarchically buildHierarchyForClasses: all) Will make the hierarchy button show the tree for all classes in that package/tag. [cid:image001.png@01D26292.CA436F50] Best regards, Henrik From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Tim Mackinnon Sent: Wednesday, December 28, 2016 5:24 PM To: Any question about pharo is welcome <pharo-users@lists.pharo.org> Subject: Re: [Pharo-users] How to view hierarchy of multiple classes in a package? This seems to have generated a bit of conversation which has helped me quite a bit. Denis, your picture has made me realise that the System browser is a bit better than I realised. However the example I was looking at was a package that had a series of Announcement subclasses, AND what wasn't obvious was that they were all subclasses of the same parent "Announcement", as that isn't shown - you just get a series of classes not rooted under some parent (even if it was object). I'm guessing that just things that are subclasses of each other in the same package are shown? I was hoping that pane might show - Announcement + A + B + C I'm now wondering what it will show if you had a few different subclasses of the different collection classes (ok it's a bad idea to subclass them, but my point is if you had a few models at different points in a hierarchy)? I'm guessing you would see the same flat list - but I will go and try that to help me learn a bit more. Tim
Ah, cool I will give that a go. As always it's very little code when you know how. I'll report back - but I wonder if this might be something that could be in the default image? Tim Sent from my iPhone
On 30 Dec 2016, at 11:49, Henrik Nergaard <draagren@outlook.com> wrote:
Changing ClassWidget>>#showHierarchy to: showHierarchy: aBoolean
| all |
(showHierarchy := aBoolean) ifFalse: [ ^ self ].
all := IdentitySet new. model selectedPackageGroup asNautilusSelection classes do: [ :cls | all addAll: cls allSuperclasses; addAll: cls withAllSubclasses ].
self cachedHierarchy: (SortHierarchically buildHierarchyForClasses: all)
Will make the hierarchy button show the tree for all classes in that package/tag. <image001.png>
Best regards, Henrik
From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Tim Mackinnon Sent: Wednesday, December 28, 2016 5:24 PM To: Any question about pharo is welcome <pharo-users@lists.pharo.org> Subject: Re: [Pharo-users] How to view hierarchy of multiple classes in a package?
This seems to have generated a bit of conversation which has helped me quite a bit.
Denis, your picture has made me realise that the System browser is a bit better than I realised.
However the example I was looking at was a package that had a series of Announcement subclasses, AND what wasn't obvious was that they were all subclasses of the same parent "Announcement", as that isn't shown - you just get a series of classes not rooted under some parent (even if it was object). I'm guessing that just things that are subclasses of each other in the same package are shown?
I was hoping that pane might show -
Announcement + A + B + C
I'm now wondering what it will show if you had a few different subclasses of the different collection classes (ok it's a bad idea to subclass them, but my point is if you had a few models at different points in a hierarchy)?
I'm guessing you would see the same flat list - but I will go and try that to help me learn a bit more.
Tim
I finally got a chance to try this change out - and this a super helpful change - thanks so much. (It also taught me where some of the things live in Pharo). Why wouldnât this change be made permanent in the live Pharo? I canât see any downside and it really helps understand new code. Tim
On 30 Dec 2016, at 10:49, Henrik Nergaard <draagren@outlook.com> wrote:
Changing ClassWidget>>#showHierarchy to: showHierarchy: aBoolean
| all |
(showHierarchy := aBoolean) ifFalse: [ ^ self ].
all := IdentitySet new. model selectedPackageGroup asNautilusSelection classes do: [ :cls | all addAll: cls allSuperclasses; addAll: cls withAllSubclasses ].
self cachedHierarchy: (SortHierarchically buildHierarchyForClasses: all)
Will make the hierarchy button show the tree for all classes in that package/tag. <image001.png>
Best regards, Henrik
From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org <mailto:pharo-users-bounces@lists.pharo.org>] On Behalf Of Tim Mackinnon Sent: Wednesday, December 28, 2016 5:24 PM To: Any question about pharo is welcome <pharo-users@lists.pharo.org <mailto:pharo-users@lists.pharo.org>> Subject: Re: [Pharo-users] How to view hierarchy of multiple classes in a package?
This seems to have generated a bit of conversation which has helped me quite a bit.
Denis, your picture has made me realise that the System browser is a bit better than I realised.
However the example I was looking at was a package that had a series of Announcement subclasses, AND what wasn't obvious was that they were all subclasses of the same parent "Announcement", as that isn't shown - you just get a series of classes not rooted under some parent (even if it was object). I'm guessing that just things that are subclasses of each other in the same package are shown?
I was hoping that pane might show -
Announcement + A + B + C
I'm now wondering what it will show if you had a few different subclasses of the different collection classes (ok it's a bad idea to subclass them, but my point is if you had a few models at different points in a hierarchy)?
I'm guessing you would see the same flat list - but I will go and try that to help me learn a bit more.
Tim
2017-01-05 12:11 GMT+01:00 Tim Mackinnon <tim@testit.works>:
I finally got a chance to try this change out - and this a super helpful change - thanks so much. (It also taught me where some of the things live in Pharo).
Why wouldnât this change be made permanent in the live Pharo? I canât see any downside and it really helps understand new code.
I think it is bad idea to replace current hierarchy view. With your solution it can be difficult to see superclasses chain of selected class when it is at the end of subclasses list. It will force user to scroll which is bad. With current approach this problem not exists. But new view mode can be extra option accessible somehow from menu.
Hi Denis - as an argument in favour, you would only see this view when you select the Hierarchy button (so its not the default) - and by pressing hierarchy, I would argue that you want to see a hierarchy of all the classes (like you see all the classes in non-hierchy mode) - if there is lots of scrolling then that might be a code smell to look into. As an extra data point - dolphin and visual age both work this way (maybe even visual works?) and I never saw it as a problem - which is why I was surprised that Pharo is different - however I know you guys often think differently. Tim
On 1 Feb 2017, at 13:22, Denis Kudriashov <dionisiydk@gmail.com> wrote:
2017-01-05 12:11 GMT+01:00 Tim Mackinnon <tim@testit.works <mailto:tim@testit.works>>: I finally got a chance to try this change out - and this a super helpful change - thanks so much. (It also taught me where some of the things live in Pharo).
Why wouldnât this change be made permanent in the live Pharo? I canât see any downside and it really helps understand new code.
I think it is bad idea to replace current hierarchy view. With your solution it can be difficult to see superclasses chain of selected class when it is at the end of subclasses list. It will force user to scroll which is bad. With current approach this problem not exists.
But new view mode can be extra option accessible somehow from menu.
2017-02-01 14:56 GMT+01:00 Tim Mackinnon <tim@testit.works>:
Hi Denis - as an argument in favour, you would only see this view when you select the Hierarchy button (so its not the default) - and by pressing hierarchy, I would argue that you want to see a hierarchy of all the classes (like you see all the classes in non-hierchy mode) - if there is lots of scrolling then that might be a code smell to look into.
Tools are just tools. They help to work with any system, no matter is it smells or not. And if switching to hierarchy will not show me superclasses just in the face I would said it is bad tool or at least not right tool which I want. I do not say that your tool with hierarchy of all classes is bad. It should be very useful like you said. But it is just different tool.
2017-02-01 14:56 GMT+01:00 Tim Mackinnon <tim@testit.works>:
As an extra data point - dolphin and visual age both work this way (maybe even visual works?) and I never saw it as a problem - which is why I was surprised that Pharo is different - however I know you guys often think differently.
There was screenshots in this discussion. VA and VisualWorks has no such hierarchal view.
participants (3)
-
Denis Kudriashov -
Henrik Nergaard -
Tim Mackinnon