Clickable class side example and initialize methods in Pharo 4.0

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

Clickable class side example and initialize methods in Pharo 4.0

Torsten Bergmann
One addition I implemented for Nautilus is that one can run examples directly
in the browser just by clicking on class side example methods icons.

See https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus
for a picture.


SO PLEASE: WHEN YOU PROVIDE EXAMPLES IN CLASSES PLEASE PUT THEM ON THE CLASS SIDE
           AND LET THE SELECTOR START WITH "example".

This way people will easily see that it is an example and can run them. Additionally it
would help to put them into a category like "examples". So be a good citized and
provide not only class comments but also examples for others to study.
 

Side note:
==========
It is also possible to click on the icon of class side initialize methods so the
class get reinitialized (after a confirmation to avoid false clicking).

https://pharo.fogbugz.com/f/cases/13894/Class-side-initialize-methods-should-be-runnable-in-Nautilus

Both issues are already integrated.

Reply | Threaded
Open this post in threaded view
|

Re: Clickable class side example and initialize methods in Pharo 4.0

Tudor Girba-2
Hi Torsten,

Thanks for this. This is indeed the way to go.

Just to let you know, the example infrastructure is also being developed in the context of GT, so we have a healthy interest overlap which is great. Only in our case, the discovery of the example happens through an <example> pragma. Would it be possible to change your slice to use this pragma instead of the example* convention?

Cheers,
Doru



On Wed, Oct 22, 2014 at 9:19 AM, Torsten Bergmann <[hidden email]> wrote:
One addition I implemented for Nautilus is that one can run examples directly
in the browser just by clicking on class side example methods icons.

See https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus
for a picture.


SO PLEASE: WHEN YOU PROVIDE EXAMPLES IN CLASSES PLEASE PUT THEM ON THE CLASS SIDE
           AND LET THE SELECTOR START WITH "example".

This way people will easily see that it is an example and can run them. Additionally it
would help to put them into a category like "examples". So be a good citized and
provide not only class comments but also examples for others to study.


Side note:
==========
It is also possible to click on the icon of class side initialize methods so the
class get reinitialized (after a confirmation to avoid false clicking).

https://pharo.fogbugz.com/f/cases/13894/Class-side-initialize-methods-should-be-runnable-in-Nautilus

Both issues are already integrated.




--

"Every thing has its own flow"
Reply | Threaded
Open this post in threaded view
|

Re: Clickable class side example and initialize methods in Pharo 4.0

Torsten Bergmann
Hi Tudor,

that should be easy now: look at CompiledMethod>>#isExampleMethod which can be adopted as needed.

Checking for the <example> pragma could be done this way:

   self pragmas anySatisfy: [:pragma | pragma keyword = #example ]

but we should think first if this is enough.

I already proposed to not only annotate with a pragma <example> but additionally give a category.
Like this:

   <example: 'Graphics'>
   <example: 'Network'>

This way we can easily build an example browser for our users where people can go through
their point of interest and browse the examples.

Maybe we should also rethink pragmas (in Pharo 5.0?) in general to be more Smalltalk
like:
 
   <Example category: 'Graphics'>

where Example is a real class in the system (!). One can even make it more explicit
then

   <ExampleCategory graphics>

with ExampleCategory(class)>>graphics returning a translateable string. People can add
own categories and one easily knows about already available ones.


Now that classes can have properties in Pharo 4.0 already I would like to see a unification
for methods and classes here (with the general concept of an "Annotation" in our metamodel).

In my opinion a method pragma is just a special form of annotating a method.

And annotating classes is usefull as well (for instance you want to annotate a class with
the appropriate Table name in an ORM framework, ...)

A comment (in a method or in a class) is also nothing more than a special annotation.
A class/method category is also an annotation. If unified a method or a class could
be in one or more categories. Even a break point for an expression is IMHO just an
annotation.  

Bye
T.


Gesendet: Mittwoch, 22. Oktober 2014 um 10:43 Uhr
Von: "Tudor Girba" <[hidden email]>
An: "Pharo Development List" <[hidden email]>
Cc: "Any question about pharo is welcome" <[hidden email]>
Betreff: Re: [Pharo-dev] Clickable class side example and initialize methods in Pharo 4.0

Hi Torsten,
 
Thanks for this. This is indeed the way to go.
 
Just to let you know, the example infrastructure is also being developed in the context of GT, so we have a healthy interest overlap which is great. Only in our case, the discovery of the example happens through an <example> pragma. Would it be possible to change your slice to use this pragma instead of the example* convention?
 
Cheers,
Doru
 
 
 
On Wed, Oct 22, 2014 at 9:19 AM, Torsten Bergmann <[hidden email]> wrote:One addition I implemented for Nautilus is that one can run examples directly
in the browser just by clicking on class side example methods icons.

See https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus[https://pharo.fogbugz.com/f/cases/13892/Example-methods-should-be-runnable-in-Nautilus]
for a picture.


SO PLEASE: WHEN YOU PROVIDE EXAMPLES IN CLASSES PLEASE PUT THEM ON THE CLASS SIDE
           AND LET THE SELECTOR START WITH "example".

This way people will easily see that it is an example and can run them. Additionally it
would help to put them into a category like "examples". So be a good citized and
provide not only class comments but also examples for others to study.


Side note:
==========
It is also possible to click on the icon of class side initialize methods so the
class get reinitialized (after a confirmation to avoid false clicking).

https://pharo.fogbugz.com/f/cases/13894/Class-side-initialize-methods-should-be-runnable-in-Nautilus[https://pharo.fogbugz.com/f/cases/13894/Class-side-initialize-methods-should-be-runnable-in-Nautilus]

Both issues are already integrated.
  
 --
www.tudorgirba.com[http://www.tudorgirba.com]
 
"Every thing has its own flow"

Reply | Threaded
Open this post in threaded view
|

Re: Clickable class side example and initialize methods in Pharo 4.0

Sean P. DeNigris
Administrator
In reply to this post by Torsten Bergmann
Torsten Bergmann wrote
One addition I implemented for Nautilus is that one can run examples directly
in the browser just by clicking on class side example methods icons.
This is cool!!! And... why stop there? I had implemented a while back "Send It" and "Inspect It" in Nautilus' method pane context menu (only appearing for unary class-side methods). I've found it very useful to be able to fire these methods without dropping into an editor. If there is interest, I will dig up the code.

Also, what's really cool about this is that it's a reminder that - oh yeah, a class is a living object like everything else. Of course the logical conclusion is a Self outliner or MathMorphs where you only interact with objects in a way that respects and highlights their aliveness, but we gotta start somewhere ;)
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Clickable class side example and initialize methods in Pharo 4.0

Sven Van Caekenberghe-2

> On 23 Oct 2014, at 05:32, Sean P. DeNigris <[hidden email]> wrote:
>
> Torsten Bergmann wrote
>> One addition I implemented for Nautilus is that one can run examples
>> directly
>> in the browser just by clicking on class side example methods icons.
>
> This is cool!!! And... why stop there? I had implemented a while back "Send
> It" and "Inspect It" in Nautilus' method pane context menu (only appearing
> for unary class-side methods). I've found it very useful to be able to fire
> these methods without dropping into an editor. If there is interest, I will
> dig up the code.

The GT-Inspector's Meta tab allows you to send unary message just by clicking. I was thinking earlier that it should be possible to extend this even for messages with arguments by just asking for them.

> Also, what's really cool about this is that it's a reminder that - oh yeah,
> a class is a living object like everything else. Of course the logical
> conclusion is a Self outliner or MathMorphs where you /only/ interact with
> objects in a way that respects and highlights their aliveness, but we gotta
> start somewhere ;)
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Clickable-class-side-example-and-initialize-methods-in-Pharo-4-0-tp4785865p4786119.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: Clickable class side example and initialize methods in Pharo 4.0

Tudor Girba-2
Yes. That is certainly a wished feature.

Doru

On Thu, Oct 23, 2014 at 7:44 AM, Sven Van Caekenberghe <[hidden email]> wrote:

> On 23 Oct 2014, at 05:32, Sean P. DeNigris <[hidden email]> wrote:
>
> Torsten Bergmann wrote
>> One addition I implemented for Nautilus is that one can run examples
>> directly
>> in the browser just by clicking on class side example methods icons.
>
> This is cool!!! And... why stop there? I had implemented a while back "Send
> It" and "Inspect It" in Nautilus' method pane context menu (only appearing
> for unary class-side methods). I've found it very useful to be able to fire
> these methods without dropping into an editor. If there is interest, I will
> dig up the code.

The GT-Inspector's Meta tab allows you to send unary message just by clicking. I was thinking earlier that it should be possible to extend this even for messages with arguments by just asking for them.

> Also, what's really cool about this is that it's a reminder that - oh yeah,
> a class is a living object like everything else. Of course the logical
> conclusion is a Self outliner or MathMorphs where you /only/ interact with
> objects in a way that respects and highlights their aliveness, but we gotta
> start somewhere ;)
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Clickable-class-side-example-and-initialize-methods-in-Pharo-4-0-tp4785865p4786119.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>





--

"Every thing has its own flow"
Reply | Threaded
Open this post in threaded view
|

Re: Clickable class side example and initialize methods in Pharo 4.0

Sean P. DeNigris
Administrator
In reply to this post by Sven Van Caekenberghe-2
Sven Van Caekenberghe-2 wrote
I was thinking earlier that it should be possible to extend this even for messages with arguments by just asking for them.
Like this? ;) http://youtu.be/vsCz7UKLqLo?list=PLn0YRc8Nw9kvQiLg82JBuI5sDRYXfEDu2 (skip to 0:40).
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Clickable class side example and initialize methods in Pharo 4.0

Sean P. DeNigris
Administrator
Oh cool, you can link to a specific start time in youtube... http://youtu.be/vsCz7UKLqLo?list=PLn0YRc8Nw9kvQiLg82JBuI5sDRYXfEDu2&t=0m40s
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Clickable class side example and initialize methods in Pharo 4.0

Sven Van Caekenberghe-2

> On 23 Oct 2014, at 17:34, Sean P. DeNigris <[hidden email]> wrote:
>
> Sean P. DeNigris wrote
>> http://youtu.be/vsCz7UKLqLo?list=PLn0YRc8Nw9kvQiLg82JBuI5sDRYXfEDu2 (skip
>> to 0:40).
>
> Oh cool, you can link to a specific start time in youtube...
> http://youtu.be/vsCz7UKLqLo?list=PLn0YRc8Nw9kvQiLg82JBuI5sDRYXfEDu2&t=0m40s

I guess so, although I am not really sure what I am looking at - but it seems very cool.


Reply | Threaded
Open this post in threaded view
|

Re: Clickable class side example and initialize methods in Pharo 4.0

kilon.alios
In reply to this post by Sean P. DeNigris
What the hell is that, looks very interesting !!!!

More information please :)

On Thu, Oct 23, 2014 at 6:34 PM, Sean P. DeNigris <[hidden email]> wrote:
Sean P. DeNigris wrote
> http://youtu.be/vsCz7UKLqLo?list=PLn0YRc8Nw9kvQiLg82JBuI5sDRYXfEDu2 (skip
> to 0:40).

Oh cool, you can link to a specific start time in youtube...
http://youtu.be/vsCz7UKLqLo?list=PLn0YRc8Nw9kvQiLg82JBuI5sDRYXfEDu2&t=0m40s



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/Clickable-class-side-example-and-initialize-methods-in-Pharo-4-0-tp4785865p4786226.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: Clickable class side example and initialize methods in Pharo 4.0

Sean P. DeNigris
Administrator
I guess so, although I am not really sure what I am looking at - but it seems very cool.
kilon.alios wrote
What the hell is that, looks very interesting !!!!
Ha ha, yeah I guess a bit of context would help ;)

It's a prototype I've been working on that combines some of (IMHO) the best IDE ideas of various systems. That particular one shows Self Outliners (the Morphs on the left of the connector). By pressing $M when an outliner has the focus, you get a "Message Menu" of Scratch-like interactive tiles for all the messages it understands. You can click on the unary messages or type expressions for the ones taking arguments (actually just realized that the binary ones don't work so just keyword messages right now). When the message is sent, a new Self Outliner open(s)InHand on the result.

It's a WIP, but if you want to play, start with:

1.
Gofer it
        smalltalkhubUser: 'SeanDeNigris' project: 'SeansPlayground';
        configurationOf: 'LivingCode';
        load. "Strangely I can not #loadDevelopment here because the ScrollableWorldMorph package doesn't get loaded, even though it does with the next line"
#ConfigurationOfLivingCode asClass project development load.
#SelfWorld asClass open.

2. Then in the search bar, type an evaluatable expression, e.g. "1" and accept
3. Drop the Outliner from the hand into the Self World
4. For fun, click the world background and drag. OMG, you have an infinite world
5. Click on the M button in the outliner and the message menu will appear (erroneously in the World instead of the Self World).
6. Expand e.g. the "bit manipulation" protocol (assuming you started with "1" as above)
7. Click into the text field to the right of bitAnd: and accept the text
A new Outliner of the result will appear in the hand

Other buttons on the Outliner:
B - open a nautilus on the class of the object
I - traditional inspector
S - open the test class if it exists (I call them Specification(s) in my personal work)
E - Evaluator (very close to Self)

Also, if you click on the icons to the right of "class" and "package" Outliner(s) will appear on those objects.

That's pretty much it for now.
Cheers,
Sean