Evaluating the reimplementation of key Context methods in Pharo

The Context class in Pharo is an essential one that models the activation of either a method or a block. A context instance can be obtained through the thisContext variable from anywhere in the code and it offers an entry point to manipulating the current execution.

For example, it offers information about the sender or about the receiver of the last message. This means that this object offers the entry point for debugging support: essentially the debugger is an inspector of this object. That means that you can do interesting things, such as debugging the debugger with the inspector.

What can I say. It’s a fun object to play with.

But, recently I stumbled across a little problem that Eliot pointed me to. Essentially, for it to work properly, the context object should directly work with the virtual machine and restrain itself from sending messages to the current receiver object. Unfortunately, in Pharo, this is not yet the case, and this leads to unwanted side effects.

Let's identify the culprit methods. Essentially, we want to find all non-extension methods that either:

  • send a message to self receiver, or
  • send a message to the receiver instance variable.

Of course, we do not want to rely on code reading. Even if the class is not very large, code reading is just not appropriate. Instead, we can write a query over the abstract syntax trees of all methods in the Context class:

Context methods select: [ :method |
    method package = method methodClass package and: [
        method parseTree doSemanticAnalysis allChildren
            anySatisfy: [ :each |
            each isMessage and: [
                (each receiver isMessage and: [
                    each receiver selector = #'receiver' ])
                or: [
                    each isMessage and: [
                        each receiver isVariable and: [
                            each receiver isInstance and: [
                                each receiver name = #receiver
                                ] ] ] ] ] ] ] ]

This query is rather long. It took me about 7 minutes. And I did not write it all at once. The way I wrote this was essentially by picking one method that I knew was problematic, and looking at its abstract syntax tree with the GTInspector. This allowed me to understand how the pattern I was looking for is actually represented in the tree, and write the query for it.


Inspecting the result of the above query in the GTInspector offers us a quick browser for only the problematic methods. Now we can read the code.


Once we have this query, besides obtaining support for browsing, we can also use it for regression testing to ensure that such an important constraint is preserved in the future.

Posted by Tudor Girba at 29 November 2015, 4:57 pm link

Pervasive software visualizations - keynote at VISSOFT 2015

On Sunday, I will give a keynote at the IEEE Working Conference on Software Visualization (VISSOFT). This is the premier research venue in the area of software visualization. It’s a real honor especially given that I have officially left the academic research world quite a number of years ago.

I will have 90 minutes to make a point, and mine will be that visualizations should become pervasive in software development. Ok, given the audience, that should not be to be too hard to convey. The more tricky part will be to show why it did not happen until now, and what we can do to change that state of facts.

To lay out the basic arguments, Andrei and I wrote a short paper on Pervasive software visualization. In short, we argue that the development environment has to change radically to allow for a natural inclusion of visualizations in regular development workflows. To this end, the IDE has to become moldable and programmable. Essentially, this direction is based on the humane assessment philosophy of empowering the developer to craft contextual tools. We exemplify this direction with our work on the Glamorous Toolkit.

Posted by Tudor Girba at 25 September 2015, 12:04 am link

Understanding Metacello load directives with GTInspector

Metacello is the configuration management engine used throughout the Pharo ecosystem. It's a powerful engine, but when things go slightly wrong it can be painful to debug.

Metacello does offer some debugging support out of the box, but this support comes mainly in terms of a textual output. For example, to debug what gets loaded, you can print the result of:

((ConfigurationOfGlamour project version: #stable) 
 ignoreImage: true)
 record loadDirective

This would produce an output like:

linear load : 
	linear load : 3.3.0 [ConfigurationOfGlamour]
		load : ConfigurationOfMagritte3
	atomic load : 3.3.0 [ConfigurationOfGlamour]
		explicit load : GlamourCore
			load : ConfigurationOfGlamourCore-CyrilFerlicot.74
		linear load : 3.2.1 [ConfigurationOfGlamourCore]
			load : ConfigurationOfRubric

This is not quite ideal. But, wait. We have a moldable inspector. As the data is actually a tree, we can display that output as a ... tree. What's more, as we often need to search, we could also offer a basic search possibility. The screenshot below shows how it looks like in the GTInspector:

The extension code looks like this:

MetacelloVersionLoadDirective>>gtInspectorLoadDirectivesIn: composite
	<gtInspectorPresentationOrder: 1>
	composite tree
		title: 'Load directives';
		display: [ { self } ];
		format: [:each | each label ifEmpty: [each title]];
		children: #gtInspectorChildren;
		filterOn: [:text :each | '\*', text, '\*' match: each label ]

This extension took about 7 minutes to write. Moldable tools can turn a problem on its head if you use them actively.

Posted by Tudor Girba at 15 September 2015, 1:27 pm link

Talk on Steering agile architecture at GOTO Night Zurich

On September 14, starting with 18:00, I will have the pleasure of giving a talk on Steering agile architecture at the GOTO Night event organized by Trifork in Zurich.

The event will also feature a Lean Coffee session with Jeff Sutherland. The event is free of charge. Please register on the event page.

Posted by Tudor Girba at 6 September 2015, 8:40 am with tags presentation, assessment, architecture, agile link

Talk on Achitecture as a Work in Progress - Limited WIP 2015

On August 26, I will have the pleasure of giving a talk on Architecture as a work in progress at an event organized by the Limited WIP Society Switzerland in Zurich.

One key aspect of dealing with the Work in Progress is to visualize the queues. We have come a long way with dealing with explicit requests that come from outside. But, how do we deal with technical problems that come from within?

Let’s take the architecture of the system. It’s rather important as it can make or break your system in the long run. Of course, the agile mantra tells us that we should emerge the architecture. This sounds great, but how do we make sure it goes in the right direction?

One way to approach it is to make technical tasks explicit and put them in the same queue as the functional ones. This never really works because of two reasons: (1) business can rarely prioritize the work, and (2) it does not fit development workflows.

We argue that it is necessary to approach technical concerns differently. We still need to make them explicit, and we also need a queue. Only, it’s a different queue that is managed exclusively by the team and worked while dealing with regular tasks.

In this interactive talk we show concrete examples of how this works in practice.

Posted by Tudor Girba at 9 August 2015, 10:34 pm with tags presentation, assessment, architecture link
<< 1 2 3 4 5 6 7 8 9 10 >>