Creating a new method

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

Creating a new method

Dirk Olmes
Hi,

I may be asking an absolute noob question but I was unable to find any
useful hints on google ...

I often find myself writing methods that do not yet exist when
implementing other methods, e.g. when I'm writing the implementation of
methodA I'm calling out to methodB.

What's the easiest way to create the new method? I know I can jump
aroung through hoops with a separate browser but that feels cumbersome.

I understand that the editor/runtime/whatever cannot know 100% of the
time where to put the new method but at least for messages to self it
should be smart enough to offer some kind of help.

-dirk

Reply | Threaded
Open this post in threaded view
|

Re: Creating a new method

Peter Uhnák
What I often do is that I write a test and then I just execute the code. When it runs into the non-existent method, the debugger offers a button "create" method.

Alternatively I do open a second browser (clicking on "scoped" in the current one or like that (or doubleclicking on a method to get the same method opened in a new browser)

Peter

On Fri, Oct 6, 2017 at 12:15 PM, Dirk Olmes <[hidden email]> wrote:
Hi,

I may be asking an absolute noob question but I was unable to find any
useful hints on google ...

I often find myself writing methods that do not yet exist when
implementing other methods, e.g. when I'm writing the implementation of
methodA I'm calling out to methodB.

What's the easiest way to create the new method? I know I can jump
aroung through hoops with a separate browser but that feels cumbersome.

I understand that the editor/runtime/whatever cannot know 100% of the
time where to put the new method but at least for messages to self it
should be smart enough to offer some kind of help.

-dirk


Reply | Threaded
Open this post in threaded view
|

Re: Creating a new method

Ben Coman
In reply to this post by Dirk Olmes


On Fri, Oct 6, 2017 at 6:15 PM, Dirk Olmes <[hidden email]> wrote:
Hi,

I may be asking an absolute noob question but I was unable to find any
useful hints on google ...

I often find myself writing methods that do not yet exist when
implementing other methods, e.g. when I'm writing the implementation of
methodA I'm calling out to methodB.

What's the easiest way to create the new method? I know I can jump
aroung through hoops with a separate browser but that feels cumbersome.

I understand that the editor/runtime/whatever cannot know 100% of the
time where to put the new method but at least for messages to self it
should be smart enough to offer some kind of help.

-dirk


A common Pharo workflow is known as "programming from within the debugger."
Run your #methodA code as soon as possible, and when the debugger pops up because someObject hasn't yet implemented #methodB, the debugger helps you create #methodB in the right place.  
 
Some examples...

Give it a go and stick with it for a while, and you'll understand why Smalltalk invented Test Driven Development (and it may change they way you think about programming.)

cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: Creating a new method

Stephane Ducasse-3
Hi Dirk

have a look at

- one one coding the counter
   http://rmod-pharo-mooc.lille.inria.fr/MOOC/Videos/W1/C019-W1S-Videos-Redo-Counter-Traditional-FR-v4.mp4
(we should have the english versions now)
   C019-W1-Videos-Redo-CodingCounterInDebugger-FR-V2-HD_720p_4Mbs.m4v

you can find the subtitles around the same folder.

Stef



On Fri, Oct 6, 2017 at 4:16 PM, Ben Coman <[hidden email]> wrote:

>
>
> On Fri, Oct 6, 2017 at 6:15 PM, Dirk Olmes <[hidden email]> wrote:
>>
>> Hi,
>>
>> I may be asking an absolute noob question but I was unable to find any
>> useful hints on google ...
>>
>> I often find myself writing methods that do not yet exist when
>> implementing other methods, e.g. when I'm writing the implementation of
>> methodA I'm calling out to methodB.
>>
>> What's the easiest way to create the new method? I know I can jump
>> aroung through hoops with a separate browser but that feels cumbersome.
>>
>> I understand that the editor/runtime/whatever cannot know 100% of the
>> time where to put the new method but at least for messages to self it
>> should be smart enough to offer some kind of help.
>>
>> -dirk
>>
>
> A common Pharo workflow is known as "programming from within the debugger."
> Run your #methodA code as soon as possible, and when the debugger pops up
> because someObject hasn't yet implemented #methodB, the debugger helps you
> create #methodB in the right place.
>
> Some examples...
> * https://www.youtube.com/watch?v=ymITEeAOtEA
> *
> http://www.virtuouscode.com/2015/05/11/in-which-i-make-you-hate-ruby-in-7-minutes/
>
> Give it a go and stick with it for a while, and you'll understand why
> Smalltalk invented Test Driven Development (and it may change they way you
> think about programming.)
>
> cheers -ben