Blog

Improving the print-it support in GTPlayground

Print it is one of the actions that exists since ancient times in Smalltalk environments. A while ago, we enhanced the GTPlayground with a Print It action that does not affect the existing code. Unlike in the classic behavior in which the printout gets inserted in the code editor, the improved version pops it up in a separate floating morph.

While this worked fine for most coding cases, every once in a while people reported the need to paste the printout in the text editor - hence the exact opposite the new solution tried to mitigate. To accommodate this use case Andrei and I made it so that you can now simply press Enter while the popping morph shows the printout and the text gets inserted in the editor.

But, there are two tiny details that come with the new version.

Editor.png

When no text is selected and you print, like in any Smalltalk environment, the whole like will be evaluated and printed. However, unlike other environments, the line will only be highlighted. This is a new mechanism that we introduced and that applies to any other commands as well (like evaluating or inspecting), and it is useful to provide a visual feedback to the user of what was actually executed. As opposed to selection the highlight has no influence on editing - in fact, it disappears as soon as you type anything.

Highlight.png

When a selection does exist, the highlight is added on top. With this mechanism, when existing the popper widget via Esc or Backspace, only the highlight gets erased, and the exact editor state is restored to how it was before printing.

The other tiny detail is that when you press Enter, the text gets pasted as a comment. In this way, the syntax highlight does not get affected.

Comment.png

It is interesting to notice how many variations there can be even in a small feature like the one mentioned above. Just because a certain solution resisted for decades, like in the case of print it, it does not mean it is the only one or even the best one. For this reason, it is our duty to explore variations and guide the search by having the developer experience in mind.

Posted by Tudor Girba at 17 January 2015, 10:50 pm with tags tooling, moose, pharo, analysis link
|

Identifying a configuration problem with GTInspector

When releasing the latest version of the Glamorous Toolkit we noticed a little problem: while in Pharo 4.0 the code worked just fine, in Pharo 3.0 we got a problem due to a reference to a class that exists only in Pharo 4.0. The problem came from the GlamourCore project, but I could not exactly see where the problem lies given that the dependencies are deeply nested.

Thus, to fix the problem I first needed a map. I inspected the object corresponding to the configuration version:

ConfigurationOfGToolkit new project version: #stable

and I started to work on a small visualization showing the dependency graph. After a couple of minutes, I ended up with a reasonable view:

Map-playgroundcode.png

The problem was that GlamourCore appeared twice: once with the 3.0.6 version and once with the 3.0.7 version. After a brief inspection, it became clear that 3.0.7 is the correct version. All that was left to do was to update the corresponding configuration dependencies.

Once the visualization code was ready, I installed it in the class of the configuration version as an inspector extension method (through the gtInspectorPresentationOrder: pragma):

gtInspectorProjectMapIn: composite
     <gtInspectorPresentationOrder: 40>
     composite roassal2
          title: 'Project map';
          initializeView: [ RTMondrian new ];
          painting: [ :view |
               view shape label text: [:each | each asString copyReplaceAll: 'ConfigurationOf' with: ''].
               view nodes: self allProjects.
               view edges
                    connectToAll: [:each | each projects collect: #version];
                    moveBehind.
               view layout horizontalDominanceTree ]

To install the method, I did not have to leave my object but wrote the code right in the inspector.

Map-code.png

After installing the new method, the inspector automatically updated itself and the visualization was ready to be used.

Map-with-problem.png

Equipped with the map, we could fix the configurations and use the visualization again to test that everything is fine:

Map-with-fix.png

The whole scenario was measured in minutes. In fact it took more time to write this post than to do the job.

Posted by Tudor Girba at 4 January 2015, 12:48 pm with tags assessment, spike, moose, story, pharo link
|

Moose 5.0

We are happy to announce version 5.0 of the Moose Suite: http://moosetechnology.org/#install

Description

This is by far the most extensive Moose release to date. Just take a look at these two trailers:

The key highlights are:

  • It is based on Pharo 3.0.
  • Roassal2 is a complete reimplementation of the core visual engine of Moose.
  • Roassal2 replaced Roassal, EyeSee and Graph-ET, and it features many new things including smooth animations, new composeable builders and several new layouts.
  • All built-in Moose visualizations use Roassal2.
  • Glamour has been extended with a Pager browser and with Rubric as the main text editor.
  • GTSpotter is a new tool that makes it possible to find objects fast.
  • GTInspector saw major usability improvements based on the Pager browser, and it now comes with many object specific extensions.
  • GTPlayground provides a new way to handle scripts and when combined with GTInspector, it can replace the dedicated easels and editors.
  • Moose Finder has been extended with the ability of handling in place visualizations.
  • GTDebugger has been strengthen and was made more robust.
  • PetitParser has been extended with the notion of context which enables elegant island parsing.

A list of issues addressed in this release can be found on the issue tracker.

Installation

The Moose Suite 5.0 comes for each platform as a separate bundle:

The Moose Suite 5.0 can also be loaded in a Pharo 3.0 image either from the Configuration Browser, or by executing the following script:

Gofer new
smalltalkhubUser: 'Moose' project: 'Moose';
configuration;
loadStable

Happy holidays!

The Moose team

Posted by Tudor Girba at 24 December 2014, 12:04 am with tags moose, tooling link
|

Introducing GTSpotter: a moldable interface for spotting objects

Search is pervasive in software development. Yet, most IDEs treat it somewhat as a side issue. As a consequence, you get multiple different search interfaces within the same environment, each of them being limited to a specific search, and not being composable with other search intefaces.

Alex Syrel, Andrei Chis and I decided it is time to change this state of facts, and we are happy to announce the first public version of GTSpotter, a novel interface for spotting objects that is part of the Glamorous Toolkit.

We had two broad goals when developing the GTSpotter interface:

  1. Provide a uniform yet moldable interface that can work on any object,
  2. Handle searching through arbitrary levels of object nesting.

Let’s take a closer look.

Spotting packages, classes, pragmas, implementors

Searching for classes or packages is a common code search requirement. Although very similar in nature, these two searches are too often supported through separated search interfaces. GTSpotter integrates them easily in one. In the example below we see the basic interface that is triggered via Cmd+Enter. On top, the user can enter a textual query, and below the search is executed through multiple search categories. In our case, entering GTSpo, leads to matching 39 classes (of which only 5 are shown) and 1 package. For each element, the matching substring is underlined.

The interface is fully controllable through the keyboard. The user can move with ArrowUp/ArrowDown between items or Cmd+Shift+ArrowUp/ArrowDown through categories. At the same time, the search field has the focus, so the user can switch seamlessly between selecting items and refining the search. Pressing Enter reveals the code browser.

Classes-packages.png

While packages and classes are typical structural entities, annotations can be equally important. GTSpotter searches for Pharo pragmas in the same interface. In this case, pressing Enter opens an inspector on the PragmaType object.

Pragmas.png

Searching for implementors is another common code search use case. Until now, the way to search for implementors in Pharo is to open a Playground, enter a the symbol, press Cmd+m and then close the Playground window. Tedious. GTSpotter makes it easier.

Implementors.png

Spotting menu items

But, it's not just code that is interesting for search. Finding a tool is a search activity as well. That is why, the main GTSpotter offers, by default, the list with the items from the World menu.

Default-menu.png

GTSpotter matches substrings. For example, searching for m b gets to the System Browser menu item, and pressing Enter spawns the browser. In essence, this produces a simple shortcut scheme.

System-browser-menu.png

Spotting past Playground pages

GTPlayground remembers all snippets ever used within the image. This is nice, but it can quickly become hard to find a previous snippet. That is why, GTSpotter makes this list searchable. For example, a common use of Playground is to enable the triggering of a Gofer loading script. Searching for Gofer new reveals all snippets used in the past. Pressing Enter reveals a Playground populated with the desired code.

Playground.png

Spotting public Playground pages

Since a while, the GTPlayground has the ability of publishing the contents to the sharing service available at: http://ws.stfx.eu. However, until now, the playground offered no easy way to load the contents of a published page. GTSpotter fixes the situation: simply pasting the url offers an object with the remote page. Pressing Enter opens a playground with the page contents.

Stfx.png

Spotting the last spotted objects

GTSpotter can find various types of objects rather fast. Yet, often we just want to get to the objects we just visited recently. It is for this reason that GTSpotter offers the history of previously spotted objects by default. For example, the picture below shows a history of 5 most recent objects.

History.png

Diving inside an object

Typical IDE search tools behave like general search tools in that they offer only one level of search. However, software systems have structure, and we often need to be able to search inside a found object. To this end, GTSpotter allows the user to dive in an object and continue searching through the same interface. This is accomplished by pressing Cmd+RightArrow.

For example, the below picture shows the case of going inside the GTSpotter class. The context of the current search is shown in the breadcrumb on top of the window. For this method, the user can search through class related facts such as methods, variables or references.

Dive-class.png

Diving in a method, again offers the same interface through which the user can search for senders or implementors.

Dive-class-method.png

Diving in a sender reveals the senders and implementors. Thus, this simple interface provides the basic block for replacing other interfaces that are dedicated to showing the list of senders, implementors or references in a separate window.

Dive-class-method-sender.png

But, GTSpotter is about objects, not about code. To exemplify the implication of this, let’s consider the typical use case of looking for a file somewhere in the directory structure inside the current directory. In the below picture, the main GTSpotter finds a directory.

Directory.png

Diving in the directory, allows the user to continue searching for deeper items.

Dive-folder-folder.png

Committing to Monticello from GTSpotter

Many development actions can be seen as search activities. Let’s consider the typical case of committing the changes of a package. First, we have to find the dirty package. Then, we have to find and choose the target repository, and then we commit.

These actions can be done directly from GTSpotter. When a dirty package exists in the image, it appears by default in the main GTSpotter in a separate searchable category.

Dirty-package.png

Diving in the package, reveals the repositories.

Dirty-package-repository.png

Selecting a repository and pressing Enter triggers the commit dialog. This is but an example of how a search interface can change established workflows. This is certainly an area that has great potential.

Diving inside a category

Let’s search for do:. The search raises 81 results. However, only 5 of them are shown.

Do-implementors.png

How can we get a hold of Collection>>do: method?

To do this, GTSpotter offers an extra action: diving in a category. Pressing Cmd+Shift+ArrowRight dives in the collection object containing only the items from that category. Thus, we can continue refining the search inside the category.

Refining a search can be applied to any category.

Dive-category-do-implementors.png

Spotting your objects

The existing implementations already comes with more than 30 various categories that support a rather extensive set of common search actions. However, the true power of GTSpotter comes from it being moldable.

Like with the GTInspector, each category is defined through corresponding extension method in the object representing the current search context.

By default, the main GTSpotter opens on itself. Thus, all the top level categories are defined as extensions of the GTSpotter class. For example, searching for all classes in the image, is achieved as follows:

GTSpotter>>spotterForClassesFor: aStep
     <spotterOrder: 10>
     aStep listProcessor
               allCandidates: [ Smalltalk allClasses ];
               title: 'Classes';
               matchSubstring;
               itemIcon: #systemIcon

Similarly, searching for the instance side methods inside a class, is achieved through an extension method of Class:

Class>>spotterMethodsFor: aStep
     <spotterOrder: 10>
     aStep listProcessor
               title: 'Instance methods';
               allCandidates: [ self methods ];
               itemName: [ :method | method selector ];
               matchSubstring

That means that you can get your objects to be equally searchable with just a handful of lines of code.

Summary

GTSpotter offers a novel interface of getting hold of an object.

If the GTPlayground and GTInspector enable a deep conversation with an object, the GTSpotter makes it possible to start that conversation quickly.

Posted by Tudor Girba at 7 December 2014, 2:03 pm with tags tooling, moose, pharo, analysis link
|

Humane assessment keynote and tutorial at "Be Fast & Curious", Cluj

Next week, on December 13, I will have the pleasure of giving a keynote and tutorial around humane assessment and Moose at the Be Fast & Curious event in Cluj, Romania.

The event is organized by 3Pillar Global. This is the first time that I am talking about these topics in Romanian, so this will actually pose a little challenge. But, considering the fact that the event poster has my head on it, I will certainly enjoy it.

If you are in the neighborhood, come and join us (the registration is free).

Poster.png

Posted by Tudor Girba at 4 December 2014, 11:03 pm with tags presentation, assessment, moose link
|
<< 1 2 3 4 5 6 7 8 9 10 >>