Moldable Object

**Problem:** When you code a class, you are several steps away from seeing the consequences of your coding. How can you close the gap between the code and the live objects?

**Forces:**

As a programmer, you want to quickly get feedback about the code you are writing.

Programmers are used to first writing code in a code editor, then compiling and running (or testing) it.

Code editors provide you feedback about the source code, not the live instances.

**Solution:**

Start coding by inspecting the Moldable Object, i.e. a live instance of the class you are coding, and not in a code editor.

Then you can incrementally add behavior to the object, and create custom views as you code to make the new behavior visible.

**Steps:**

You can inspect a moldable object in many ways.

You can inspect the result of evaluating a Smalltalk expression in a Playground. This can be a code snippet in a Lepiter page, or a Playground associated with another tool, such as an Inspector or Coder.

[…]

**Related Patterns:**

If you are modeling external data, you can create a moldable object from a Viewable Data Wrapper.

Once you have a moldable object, you can mold it from a Contextual Playground.

**Known Uses:**

In Smalltalk, it is a common practice to modify code in the debugger, and continue execution. From the debugger one can explore the state and behavior of live objects on the stack, evaluate code snippets to test hypotheses, modify the compiled methods on the stack, and continue running the program.

DOT FROM two-level-diagram