Use Code To Bookmark

last modified: September 11, 2003

Some programming languages and environments provide good search facilities for finding things like methods calls. The prime example, the SmalltalkLanguage, allows you to look for all the senders of a given message. You can exploit this feature to bookmark points in your code that you want to come back to by adding, say, a toDo: method to Object. You can then say:

aThingyWidget 
  disconnect;
  toDo: 'make sure everything is cleaned up properly'

The implementation of toDo: might be empty or might write its parameter to a log. When you go to production, you make sure that there are no senders of toDo: left in the code. In other languages, you could add a method to some debugging or infrastructure class, in the same way that people have assertion classes. -- SteveFreeman


Interesting idea. See also FixmeComment, and UnitTestAsTickler. -- MartinPool et rj.


Loading...