small case study

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

small case study

abergel
Hi!

Just to share a small use I had of Moose.

I am working on Roassal2. Roassal2 will be largely compatible with Roassal1. I am trying to make GraphET use Roassal2, and I need to know where Roassal is actually used by GraphET. Moose is ideal for this. 

I opened the moose panel, imported GraphET and type the following script in a Roassal easel opened on a class group:
-=-=-=-=-=-=-=-=-=-=-=-=
view shape rectangle 
if: #isStub fillColor: Color veryVeryLightGray;
if: #isSUnitTestCase borderColor: Color green.
view nodes: classGroup forEach: [ :cls |
view shape rectangle 
if: [ :m | (m queryAllOutgoingAssociations atTypeScope select: [:c | c name beginsWith: 'RO' ] ) notEmpty ] fillColor: Color red;
if: [ :m | (m queryAllOutgoingAssociations atTypeScope select: [:c | c name beginsWith: 'RT' ] ) notEmpty ] fillColor: Color blue.
view interaction 
popupText: [ :m | ((m queryAllOutgoingAssociations atTypeScope select: [:c | c name beginsWith: 'RO' ]) inject: '' into: [ :s :e | s, '  ', e name ]), String cr, '-----', String cr, m sourceText ]; 
action: #inspect;
on: ROMouseClick do: [:event | event model browseSource ].
view nodes: cls methods.
view gridLayout.
].
view edgesFrom: #superclass.
view treeLayout 
-=-=-=-=-=-=-=-=-=-=-=-=

It gives a pictures as the following one:

large squares are classes
link are inheritance: superclass is above its subclasses
Inner squares are methods
red square are methods of GraphET that reference to Roassal1 classes
blue square are methods that have been migrated to Roassal2.
Gray classes are stub classes

A popup window details what is the reference. E.g., 

This is a popup I get by having the mouse above a method initialize. The reference to Roassal is because of the use of “ROElement”. I can click on the class to open a code browser on it. I can then modify the reference of ROElement to RTElement...

Happy new year!
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




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

Re: small case study

Tudor Girba-2
Excellent! That is exactly the spirit we should promote for developing in Pharo. I think this is an area where Moose can contribute greatly. We really have a shot at setting a new standard for how code should be developed.

I will publish a longer blog post on the issue, but in the meantime, here is a quick reply. Actually, you do not need to load the whole project into a FAMIX model. You can do it simpler now directly with the Pharo objects.

Inspect this:

(RPackageOrganizer default packageNamed: 'Graph-ET')
allMethodReferences select: [ :each |
each method literalStrings anySatisfy: [ :literal |
literal notNil and: [literal beginsWith: 'RO' ] ] ]

You get a simple list of RGMethodDefinitions that you can go through like you would do in a to do.

The cool thing is that you can preview the source code in the inspector, and you can even modify the code right there. Essentially, you get a highly focused code browser (see attached).

Inline image 2

Of course, you can also create a visualization, if you want.

| view |
view := ROMondrianViewBuilder new.
view 
nodes: (RPackageOrganizer default packageNamed: 'Graph-ET') classes 
forEach: [:cls | 
view shape rectangle 
if: [ :m | 
m method literalStrings anySatisfy: [ :literal |
literal notNil and: [literal beginsWith: 'RO' ]] ] 
fillColor: Color red.
view nodes: ((cls methods select: [:m | m package name beginsWith: 'Graph-ET']) collect: #asRingDefinition).
view gridLayout ].
view edgesFrom: #superclass.
view narrowTreeLayout.
view

If you inspect the view and click on a method, guess what :)

Inline image 1

There are things to improve here. One thing I would want is for the list of items to update when I am accepting the code. Another thing is that we should make Ring more concise.

Nevertheless, it is already exciting. Don't you think so?

Cheers,
Doru





On Tue, Dec 31, 2013 at 10:12 PM, Alexandre Bergel <[hidden email]> wrote:
Hi!

Just to share a small use I had of Moose.

I am working on Roassal2. Roassal2 will be largely compatible with Roassal1. I am trying to make GraphET use Roassal2, and I need to know where Roassal is actually used by GraphET. Moose is ideal for this. 

I opened the moose panel, imported GraphET and type the following script in a Roassal easel opened on a class group:
-=-=-=-=-=-=-=-=-=-=-=-=
view shape rectangle 
if: #isStub fillColor: Color veryVeryLightGray;
if: #isSUnitTestCase borderColor: Color green.
view nodes: classGroup forEach: [ :cls |
view shape rectangle 
if: [ :m | (m queryAllOutgoingAssociations atTypeScope select: [:c | c name beginsWith: 'RO' ] ) notEmpty ] fillColor: Color red;
if: [ :m | (m queryAllOutgoingAssociations atTypeScope select: [:c | c name beginsWith: 'RT' ] ) notEmpty ] fillColor: Color blue.
view interaction 
popupText: [ :m | ((m queryAllOutgoingAssociations atTypeScope select: [:c | c name beginsWith: 'RO' ]) inject: '' into: [ :s :e | s, '  ', e name ]), String cr, '-----', String cr, m sourceText ]; 
action: #inspect;
on: ROMouseClick do: [:event | event model browseSource ].
view nodes: cls methods.
view gridLayout.
].
view edgesFrom: #superclass.
view treeLayout 
-=-=-=-=-=-=-=-=-=-=-=-=

It gives a pictures as the following one:

large squares are classes
link are inheritance: superclass is above its subclasses
Inner squares are methods
red square are methods of GraphET that reference to Roassal1 classes
blue square are methods that have been migrated to Roassal2.
Gray classes are stub classes

A popup window details what is the reference. E.g., 

This is a popup I get by having the mouse above a method initialize. The reference to Roassal is because of the use of “ROElement”. I can click on the class to open a code browser on it. I can then modify the reference of ROElement to RTElement...

Happy new year!
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




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




--

"Every thing has its own flow"

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

Re: small case study

abergel
Wow!!!
Impressive!!!

Alexandre


On Jan 1, 2014, at 8:31 PM, Tudor Girba <[hidden email]> wrote:

> Excellent! That is exactly the spirit we should promote for developing in Pharo. I think this is an area where Moose can contribute greatly. We really have a shot at setting a new standard for how code should be developed.
>
> I will publish a longer blog post on the issue, but in the meantime, here is a quick reply. Actually, you do not need to load the whole project into a FAMIX model. You can do it simpler now directly with the Pharo objects.
>
> Inspect this:
>
> (RPackageOrganizer default packageNamed: 'Graph-ET')
> allMethodReferences select: [ :each |
> each method literalStrings anySatisfy: [ :literal |
> literal notNil and: [literal beginsWith: 'RO' ] ] ]
>
> You get a simple list of RGMethodDefinitions that you can go through like you would do in a to do.
>
> The cool thing is that you can preview the source code in the inspector, and you can even modify the code right there. Essentially, you get a highly focused code browser (see attached).
>
> <Inspector on an OrderedCollection (an O...ls)).png>
>
> Of course, you can also create a visualization, if you want.
>
> | view |
> view := ROMondrianViewBuilder new.
> view
> nodes: (RPackageOrganizer default packageNamed: 'Graph-ET') classes
> forEach: [:cls |
> view shape rectangle
> if: [ :m |
> m method literalStrings anySatisfy: [ :literal |
> literal notNil and: [literal beginsWith: 'RO' ]] ]
> fillColor: Color red.
> view nodes: ((cls methods select: [:m | m package name beginsWith: 'Graph-ET']) collect: #asRingDefinition).
> view gridLayout ].
> view edgesFrom: #superclass.
> view narrowTreeLayout.
> view
>
> If you inspect the view and click on a method, guess what :)
>
> <Inspector on an OrderedCollection (an O...ls)) - roassal.png>
>
> There are things to improve here. One thing I would want is for the list of items to update when I am accepting the code. Another thing is that we should make Ring more concise.
>
> Nevertheless, it is already exciting. Don't you think so?
>
> Cheers,
> Doru
>
>
>
>
>
> On Tue, Dec 31, 2013 at 10:12 PM, Alexandre Bergel <[hidden email]> wrote:
> Hi!
>
> Just to share a small use I had of Moose.
>
> I am working on Roassal2. Roassal2 will be largely compatible with Roassal1. I am trying to make GraphET use Roassal2, and I need to know where Roassal is actually used by GraphET. Moose is ideal for this.
>
> I opened the moose panel, imported GraphET and type the following script in a Roassal easel opened on a class group:
> -=-=-=-=-=-=-=-=-=-=-=-=
> view shape rectangle
> if: #isStub fillColor: Color veryVeryLightGray;
> if: #isSUnitTestCase borderColor: Color green.
> view nodes: classGroup forEach: [ :cls |
> view shape rectangle
> if: [ :m | (m queryAllOutgoingAssociations atTypeScope select: [:c | c name beginsWith: 'RO' ] ) notEmpty ] fillColor: Color red;
> if: [ :m | (m queryAllOutgoingAssociations atTypeScope select: [:c | c name beginsWith: 'RT' ] ) notEmpty ] fillColor: Color blue.
> view interaction
> popupText: [ :m | ((m queryAllOutgoingAssociations atTypeScope select: [:c | c name beginsWith: 'RO' ]) inject: '' into: [ :s :e | s, '  ', e name ]), String cr, '-----', String cr, m sourceText ];
> action: #inspect;
> on: ROMouseClick do: [:event | event model browseSource ].
> view nodes: cls methods.
> view gridLayout.
> ].
> view edgesFrom: #superclass.
> view treeLayout
> -=-=-=-=-=-=-=-=-=-=-=-=
>
> It gives a pictures as the following one:
> <Screen Shot 2013-12-31 at 6.00.10 PM.png>
>
> large squares are classes
> link are inheritance: superclass is above its subclasses
> Inner squares are methods
> red square are methods of GraphET that reference to Roassal1 classes
> blue square are methods that have been migrated to Roassal2.
> Gray classes are stub classes
>
> A popup window details what is the reference. E.g.,
> <Screen Shot 2013-12-31 at 6.07.05 PM.png>
>
> This is a popup I get by having the mouse above a method initialize. The reference to Roassal is because of the use of “ROElement”. I can click on the class to open a code browser on it. I can then modify the reference of ROElement to RTElement...
>
> Happy new year!
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
>
>
> --
> www.tudorgirba.com
>
> "Every thing has its own flow"
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: small case study

Usman Bhatti
Excellent work Alex and Doru.

Usman


On Thu, Jan 2, 2014 at 2:37 PM, Alexandre Bergel <[hidden email]> wrote:
Wow!!!
Impressive!!!

Alexandre


On Jan 1, 2014, at 8:31 PM, Tudor Girba <[hidden email]> wrote:

> Excellent! That is exactly the spirit we should promote for developing in Pharo. I think this is an area where Moose can contribute greatly. We really have a shot at setting a new standard for how code should be developed.
>
> I will publish a longer blog post on the issue, but in the meantime, here is a quick reply. Actually, you do not need to load the whole project into a FAMIX model. You can do it simpler now directly with the Pharo objects.
>
> Inspect this:
>
> (RPackageOrganizer default packageNamed: 'Graph-ET')
>       allMethodReferences select: [ :each |
>               each method literalStrings anySatisfy: [ :literal |
>                       literal notNil and: [literal beginsWith: 'RO' ] ] ]
>
> You get a simple list of RGMethodDefinitions that you can go through like you would do in a to do.
>
> The cool thing is that you can preview the source code in the inspector, and you can even modify the code right there. Essentially, you get a highly focused code browser (see attached).
>
> <Inspector on an OrderedCollection (an O...ls)).png>
>
> Of course, you can also create a visualization, if you want.
>
> | view |
> view := ROMondrianViewBuilder new.
> view
>       nodes: (RPackageOrganizer default packageNamed: 'Graph-ET') classes
>       forEach: [:cls |
>               view shape rectangle
>                       if: [ :m |
>                               m method literalStrings anySatisfy: [ :literal |
>                                       literal notNil and: [literal beginsWith: 'RO' ]] ]
>                       fillColor: Color red.
>               view nodes: ((cls methods select: [:m | m package name beginsWith: 'Graph-ET']) collect: #asRingDefinition).
>               view gridLayout ].
> view edgesFrom: #superclass.
> view narrowTreeLayout.
> view
>
> If you inspect the view and click on a method, guess what :)
>
> <Inspector on an OrderedCollection (an O...ls)) - roassal.png>
>
> There are things to improve here. One thing I would want is for the list of items to update when I am accepting the code. Another thing is that we should make Ring more concise.
>
> Nevertheless, it is already exciting. Don't you think so?
>
> Cheers,
> Doru
>
>
>
>
>
> On Tue, Dec 31, 2013 at 10:12 PM, Alexandre Bergel <[hidden email]> wrote:
> Hi!
>
> Just to share a small use I had of Moose.
>
> I am working on Roassal2. Roassal2 will be largely compatible with Roassal1. I am trying to make GraphET use Roassal2, and I need to know where Roassal is actually used by GraphET. Moose is ideal for this.
>
> I opened the moose panel, imported GraphET and type the following script in a Roassal easel opened on a class group:
> -=-=-=-=-=-=-=-=-=-=-=-=
> view shape rectangle
>       if: #isStub fillColor: Color veryVeryLightGray;
>       if: #isSUnitTestCase borderColor: Color green.
> view nodes: classGroup forEach: [ :cls |
>       view shape rectangle
>                                       if: [ :m | (m queryAllOutgoingAssociations atTypeScope select: [:c | c name beginsWith: 'RO' ] ) notEmpty ] fillColor: Color red;
>                                       if: [ :m | (m queryAllOutgoingAssociations atTypeScope select: [:c | c name beginsWith: 'RT' ] ) notEmpty ] fillColor: Color blue.
>       view interaction
>               popupText: [ :m | ((m queryAllOutgoingAssociations atTypeScope select: [:c | c name beginsWith: 'RO' ]) inject: '' into: [ :s :e | s, '  ', e name ]), String cr, '-----', String cr, m sourceText ];
>               action: #inspect;
>               on: ROMouseClick do: [:event | event model browseSource ].
>       view nodes: cls methods.
>       view gridLayout.
> ].
> view edgesFrom: #superclass.
> view treeLayout
> -=-=-=-=-=-=-=-=-=-=-=-=
>
> It gives a pictures as the following one:
> <Screen Shot 2013-12-31 at 6.00.10 PM.png>
>
> large squares are classes
> link are inheritance: superclass is above its subclasses
> Inner squares are methods
> red square are methods of GraphET that reference to Roassal1 classes
> blue square are methods that have been migrated to Roassal2.
> Gray classes are stub classes
>
> A popup window details what is the reference. E.g.,
> <Screen Shot 2013-12-31 at 6.07.05 PM.png>
>
> This is a popup I get by having the mouse above a method initialize. The reference to Roassal is because of the use of “ROElement”. I can click on the class to open a code browser on it. I can then modify the reference of ROElement to RTElement...
>
> Happy new year!
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
>
>
> --
> www.tudorgirba.com
>
> "Every thing has its own flow"
> _______________________________________________
> 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


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