No, Wait! Do it in a Workspace!

No, wait! The problem with what we just did (in an inspector) is that it isn’t reproducible. We have no way to save a record of what we have done. If this task, or one like it, ever has to be done again, we’ll have to type it in all over again. If we are called upon to do it, we might be able to remember a little about it. Others will have to invent the approach, and theirs might not be as effective as ours was.

When you’re working on some task that you haven’t done before, and it is going to require some sequential processing (grab an object, do something to it to get another object, etc), do it in a workspace. Not step by step, inspecting, sending, modifying, inspecting deeper.

Rather, set up the workspace to do the entire task, showing all steps. Let the sequence become obvious, and retain it in the workspace, rather than in your head. When you’ve got the workspace code working, the shape of the objects and methods you need will be much more obvious. You’ll make faster progress because Smalltalk is remembering things for you.

When you’re finished, save the workspace for future reference. One good way to do that is to make the workspace a method on the object you started with.

Note: the code we get in the workspace still isn’t very well factored. In some ways it is even worse than the code in the inspectors: at least that code referred basically to only one object. This is troubling: what does it suggest to you?

Posted on:

Written by: Ron Jeffries

Categorization: Practices

Recent Articles

Scrum Information Base — Agile Skills

Chet Hendrickson and I have offered to help the Scrum Alliance build a broad and growing base of information relating to Scrum / Agile, and to the many skills and practices that can help teams be successful. Our offer has…

Why Did You Do That, Ron?

Piers Thompson sent me a good question about my recent database articles. I suspect others would like to hear the question and answers.

Events & Classes

  • No events.