I found that at first I was very slow at reading/groking Smalltalk code, it was like being in a twisty maze with lots of paths leading to tiny little rooms that make little sense if you're only thinking about the room that you're in. I wondered if Smalltalk wasn't over complicating things with all it's tiny methods. But the more time I spent using the tools (browse senders/implementers / and debugger) to slowly go through the maze, the more it started to make sense. These days I feel like Smalltalk is the perfect system for allowing me to quickly understand what the code does. I think the more you read code the more you start to develop intuition about how things are usually put together, and often I see methods and patterns and think 'ahh, that probably does this', and i don't even need to check senders/implementers. I also noticed that now when i read new code I tend to look from a higher level first and make some guesses about what is doing what, then zoom in and get the details. On 5 January 2017 at 19:24, Siemen Baader <siemenbaader@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... 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-VideosDebugger....
Any tips? I think I don't see the forest for the trees here I'm afraid :)
thanks, Siemen