Talking Meta

Meta talk about Smalltalk, Seaside, Magritte, Pier and related things.

New OmniBrowser Completion Dialog

The latest version of OmniBrowser includes a completion dialog that is used at various places to ease the use of the keyboard. This new dialog is currently used for the following features:

  • Finding Classes (Ctrl+F)
  • Finding Implementors (Ctrl+M) and Senders (Ctrl+N)
  • Creating and Renaming Categories and Protocols
  • Triggering Commands (Ctrl+Shift+T) (new)
  • Selecting Windows (Ctrl+Shift+W) (new)

The following video gives a quick overview of these features:

Posted by Lukas Renggli at 25 September 2010, 6:14 pm with tags omnibrowser, smalltalk 2 comments link

On Correctly Spelling Variable Names

The code critics tool of the Refactoring Browser points out all kinds of code smells. However, correct spelling of entities in source code is an often neglected smell and remains unchecked by the traditional rules.

As an example take the current development version of Seaside. In my development image there are 8757 methods. In total these methods declare 1403 temporary variables. 84 variables are marked because of suspicious spelling. About a quarter of these variables are actually spelled wrong.

Spelling.jpg

I published a new extension to code critics. Load the latest versions of Refactoring-Core and Refactoring-Spelling from the repository on SqueakSource. Use the OmniBrowser integration to run the checks. If you run on OS X, the spell checker of the system is used thanks to the excellent plugin of John McIntosh. On other platforms, a weaker built-in spell checker is used. The checks work at the level of AST nodes and individually check the following code elements:

  • class names
  • class comments
  • class categories
  • instance variable names
  • class variable names
  • pool variable names
  • method protocols
  • method selectors
  • method comments
  • literal values
  • argument variable names
  • temporary variable names

Given that the spell checker is not integrated with Pier yet, it is up to you to find the spelling errors in this post.

Posted by Lukas Renggli at 8 February 2009, 2:48 pm with tags smalltalk, refactoring, lint, omnibrowser 2 comments link

How to ignore Code Critics rules?

A less well known feature of my recent changes and improvements to the Refactoring Browser, and especially the integrated Code Critic tools (including Slime, the Seaside consultant in a box) is the possibility to ignore certain rules on annotated methods. Simply add a pragma to the method you want a certain rule to ignore:

renderContentOn: html
"Renders the basic structure of the application."

<lint: 'Long methods' rationale: 'Rendering method' author: 'lr'>
...

The first argument is the title of the rule, as it appears in code critics user interface. Second and third argument are optional, but it usually makes sense to explain why it is a good decision to ignore the rule in the given method.

The idea is not to overuse this feature. That’s also why you actually have to type it in all by hand, even if it would be easy to automate that. The goal is to encourage developers to fix the real issue instead, something that works very well for me.

Posted by Lukas Renggli at 25 October 2008, 12:11 pm with tags refactoring, omnibrowser 2 comments link

Code Critics in OB

In this screencast (5.4 MB) I present 3 tools from the refactoring engine and how they are integrated into the OmniBrowser framework. These demoed tools are:

  • Code Critics: Detect common problems and possible bugs in your code, and even provides automatic transformations to fix some of these issues.
  • Parse Tree Searcher: Allows one to search for arbitrary code snippets.
  • Rewrite Engine: Enables you to quickly define your own refactorings, based on the parse tree searcher.

Update: Check out this article for information on how to load these tools.

Posted by Lukas Renggli at 28 March 2008, 8:40 pm with tags pharo, squeak, refactoring, omnibrowser, screencast 2 comments link

New Refactorings

In this screencast (2.1 MB) I present 3 new refactorings that were are not part of the original refactoring browser. I use these refactorings on a daily bases and I think that they are a huge time saver.

Update: The refactorings presented in this screen-cast are the following ones:

  • Create accessors for class: This is a composite refactoring that uses the existing accessor refactoring to create accessors for all instance-variables.
  • Realize class: This refactoring overrides all abstract methods of the superclasses with a method that calls #shouldBeImplemented.
  • Move method to class/instance side: This refactoring moves the selected method from class- to instance-side or vice-versa.
Posted by Lukas Renggli at 18 March 2008, 8:59 am with tags pharo, squeak, refactoring, omnibrowser, screencast 4 comments link
<< 1 2 >>