visualizing package dependencies

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

visualizing package dependencies

Peter Uhnak
Hi,

after a year of using Moose I actually wanted to use it for what it was made for... and I kind of don't know how...

so basically I have packages (let's call them B1 B2 and D1 D2 D3) and I would like to visualize all dependencies between classes in those packages.
More specifically I'm interested in all calls from D* packages to B*...

After looking through TheMooseBook I've found things like MooseModel and MoViewRenderer, which the first I assume is related to non-smalltalk code and second is outdated version of RTMondrian.
RTMondrian however doesn't have documentation yet and I am kind of lost.

How do I define that I am interested only in calls between those packages (that's without calls inside a package)? Ideally if it can also display the name of the methods.

I could probably build it procedurally going in cycles class by class, method by method but I was hoping there's better way.

Any pointers appreciated,

Peter

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: visualizing package dependencies

Nicolas Anquetil

Hi,

you can start with moose Chef:

D1 queryOutgoingDependencies withinPackage: B1

nicolas


On 02/07/2015 00:29, Peter Uhnák wrote:
Hi,

after a year of using Moose I actually wanted to use it for what it was made for... and I kind of don't know how...

so basically I have packages (let's call them B1 B2 and D1 D2 D3) and I would like to visualize all dependencies between classes in those packages.
More specifically I'm interested in all calls from D* packages to B*...

After looking through TheMooseBook I've found things like MooseModel and MoViewRenderer, which the first I assume is related to non-smalltalk code and second is outdated version of RTMondrian.
RTMondrian however doesn't have documentation yet and I am kind of lost.

How do I define that I am interested only in calls between those packages (that's without calls inside a package)? Ideally if it can also display the name of the methods.

I could probably build it procedurally going in cycles class by class, method by method but I was hoping there's better way.

Any pointers appreciated,

Peter


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: visualizing package dependencies

abergel
In reply to this post by Peter Uhnak
Hi Peter, 

Here are two solutions. 

-== 1 - Without using Moose ==-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Set the name of the packages"
packageNames := { 'Roassal2' . 'Trachel' . 'Glamour-Roassal2-Presentations' }.

"Get the packages"
packages := packageNames collect: [ :pName | RPackageOrganizer default packageNamed: pName ].

"Get all classes"
allClasses := packages flatCollect: #classes.

b := RTMondrian new.
b nodes: packages forEach: [ :package |
b nodes: package classes.
b layout grid.
].

"For each class we draw lines to its dependent classes"
b shape line color: (Color blue alpha: 0.3).
b edges
objects: allClasses from: #yourself toAll: #dependentClasses.

b
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


-== 2 - Using Moose ==-
This involves a few more steps (note that you need to update Moose since I have just fixed a bug):
1 - Open the Moose Panel
2 - Press the ST-> button, top right button of the moose panel window
3 - Select the three packages:  'Roassal2' . 'Trachel' . 'Glamour-Roassal2-Presentations’. As in: 
4 - Press Next and Finish
5 - Open an inspector on the group of packages in the model. As in the screenshot:
6 - In the inspector, enter the following script:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
allClasses := self flatCollect: #classes.

b := RTMondrian new.
b nodes: self forEach: [ :package |
b nodes: package classes.
b layout grid.
].
b shape line color: (Color blue alpha: 0.3).
b edges
objects: allClasses from: #yourself toAll: [ :c | c queryOutgoingDependencies atTypeScope ].
b
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 - you should get:

Wow, many more dependencies using Moose than plain Pharo! The reason is simple. Without using Moose, the script used #dependentClasses, which return the list of classes directly referenced in the literal frame. 
In the second script, Moose use the method invocation.

Let us know if you need more help.

Cheers,
Alexandre

On Jul 2, 2015, at 12:29 AM, Peter Uhnák <[hidden email]> wrote:

Hi,

after a year of using Moose I actually wanted to use it for what it was made for... and I kind of don't know how...

so basically I have packages (let's call them B1 B2 and D1 D2 D3) and I would like to visualize all dependencies between classes in those packages.
More specifically I'm interested in all calls from D* packages to B*...

After looking through TheMooseBook I've found things like MooseModel and MoViewRenderer, which the first I assume is related to non-smalltalk code and second is outdated version of RTMondrian.
RTMondrian however doesn't have documentation yet and I am kind of lost.

How do I define that I am interested only in calls between those packages (that's without calls inside a package)? Ideally if it can also display the name of the methods.

I could probably build it procedurally going in cycles class by class, method by method but I was hoping there's better way.

Any pointers appreciated,

Peter
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev