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