On Fri, Jan 6, 2017 at 3:24 AM, Siemen Baader <siemenbaa...@gmail.com> wrote:
> Hi All,
>
> I may be missing the obvious, but what are good strategies to understand the
> structure of existing code? Specifically, I'm trying to understand more of
> PharoJS to solve my own problems and eventually also to contribute back -
> but this is a general question.
>
> There is this one MOOC exercise:
> http://rmod-pharo-mooc.lille.inria.fr/MOOC/Exercises/Exercises-Pillar/Pillar-Questions.pdf
> that helps, and reading tests and comments helps if they exist. But I often
> get trapped in drilling down a long call stack and opening many, many
> browser windows, a new one for every message send to a new class.
>
> While writing this it occured to me that I can use the debugger to follow a
> call stack by putting a breakpoint in the top level method, then stepping
> down using the debugger. There is also a MOOC lecture on that that I will
> look at again,
> http://rmod-pharo-mooc.lille.inria.fr/MOOC/Videos/W5/C019-W2S-VideosDebugger1-UsingTheDebugger-V2-HD_720p_4Mbs.m4v.
>
> Any tips? I think I don't see the forest for the trees here I'm afraid :)


This one I just thought of, so YMMV. Try...
   World menu > Tools > Time Profiler

Evaluate code for some point of interest (you may need to wrap it in a loop)
then browse the static call tree to
* view the common execution paths as an overview of code structure
* provide a reading order for class comments
* suggest places to insert breakpoints to watch what live is happening.

In some cases you might need...
   World menu > System > Start profiling all processes


Another way I often to learn what happens behind Pharo tools if
opening halos on a button-of-interest (make sure you click cycling
through to the PluggableButtonMorph)
then "Inspect Morph" and determine the method called when the button
is pressed and drop a halt in that method. This might not be
applicable to PharoJS.

cheers -ben

Reply via email to