Sometimes you just need some easy hacks to make your life much easier.

One of them is to keep track of things you have to do later. Be it cleanups, some other thing to take care of once “this is done”.

We as Smalltalk developers live, drink and breathe source code and objects and are most comfortable within our beloved Smalltalk environment. So how do you mark a method as something to be taken care of later? And how do you make sure you can keep track of these places?

The answer is so blindingly easy that I wasn’t sure if I should take the time to write it down and steal your time to read it. Yet, it is one of those life hacks that open new possibilities if you didn’t know it yet.. So here it is:

Implement a method like toDo: (or use one that’s available)

We’ll use the Smalltalk tools for our purpose. So the easiest thing we can do is use the mechanism to find senders.

First we need a method named #toDo: or similar on Oject. If you have Glorp loaded in your image, you already have such a method, it is called #needsWork: and takes a parameter. The parameter is what makes things interesting, because you can now hand a String (or whatever you want) as a parameter to the method.

What does this method do? Well, it doesn’t really matter, as long as it doesn’t break your program 😉 So the implementation of needsWork in Glorp is beautiful and maintainable:

needsWork: aString

	^self.

Since the return of #self ist standard behaviour in Smalltalk anyways, you could as well keep the method empty. You can add some comments, add some logging or whatever, just make sure the method has no side effects.

How to find these places?

Well, you can now search for senders of #toDo: or #needsWork: and read the comments to work on your to do – list.

So this is all I have to tell you about this. You’re welcome. This trick works on all Smalltalk dialects and has been used for decades.

Just one bonus for you: If you like to collect important snippets for your daily work in a Workspace or even are a fan of adding your own Menu items to the System Transcript or like to automate stuff, here is a little snippet to open a Browser on all Senders of a Method in VA Smalltalk:

System image allMethodsSending: #needsWork:

Just evaluate this whenever you need to know what’s on your list for today.

That’s all folks, have fun Smalltalking

2 thoughts on “Little VAST hacks: Keep Track of (and re-find) needed Changes

  1. Hi Joachim,
    Pharo has a similar method called #flag: aSymbol. Common uses are: “self flag: #todo” or “self flag: #fixMe” etc… Recently, we discussed to include something like this into VAST base product. We believe #flag: is too risky as it may conflict with existing customer methods. Therefore, we thought “Object >> flagMethodWith: aSymbol” would be a better choice. We will take a look for this in 9.3.
    Best,

    1. Mariano,

      thanks for your comment. Either I don’t really understand or I dislike the idea of using Symbols for the description of what I want to remind myself of. I tend to write a little longer descriptions sometimes.

      The idea here might be that you can easily build tools to use the symbols for further automation and such. But I like the idea of using Strings. So I guess this is a request for #flagMethodWith:additionalInfo: …

Comments are closed.