Introduction
Published in 1977 by Alan Borning at Xerox PARC, ThingLab represents a landmark development in the evolution of simulation environments. It successfully synthesized the modularity of object-oriented programming—specifically the Smalltalk paradigm—with the declarative power of constraint-based modeling. By bridging the gap between procedural logic and the geometric constraint-solving pioneered by systems like Sketchpad, ThingLab provided a flexible framework for modeling complex physical and logical systems.
The Challenge of Rigid Simulations
In the late 1970s, simulation software was typically specialized and rigid. Creating a model of an electrical circuit or a mechanical bridge required writing specific procedural code to define how every individual component interacted with its neighbors. This approach lacked modularity and made incremental design difficult.
Borning identified two primary hurdles for a more flexible system:
- Connectivity: A robust method was needed to represent physical or logical joins between separate objects (e.g., a resistor terminal meeting a wire).
- Behavioral Automation: The system needed to ensure that if a user manipulated one part of a structure, the rest of the system would update according to governing laws (such as Ohm’s Law or Kirchhoff’s Law) without the user having to manually re-calculate every state change.
System Architecture and Methods
ThingLab was built on Smalltalk-72, but it introduced several significant departures from standard object-oriented conventions of the era to accommodate its simulation goals.
Prototypes and Descendants
Unlike standard Smalltalk, which relies on a strict class-instance distinction, ThingLab utilized a prototype-based model. Users created new objects by generating a "descendant" of an existing prototype and then modifying its specific properties. This allowed for a more fluid, incremental approach to building complex models.
Constraint Satisfaction Strategies
To maintain the integrity of a simulation, ThingLab employed three distinct strategies to satisfy constraints:
- One-pass Propagation: An efficient ordering method that updates objects sequentially, ensuring each is processed only once.
- Relaxation: An iterative numerical method used primarily for "circular" constraints common in real-valued physics, where variables are mutually dependent.
- Assumed States: A depth-first search mechanism used to resolve conditional logic and discrete states.
The Merging Operation
The "secret sauce" of ThingLab is the Merging Operation. This single abstraction serves two critical roles. First, it facilitates multiple inheritance, allowing an object to combine properties from several parents. Second, it handles connectivity. To connect two components, a user "merges" their terminal nodes into a single new node. This new node automatically inherits the constraints of both original parts, effectively creating a unified system of equations for the solver.
Key Insights
ThingLab introduced several concepts that would become influential in later computer science research:
- Constraints as First-Class Objects: Constraints in ThingLab are not merely hard-coded rules; they are objects with their own properties, including
error(the distance from the goal state) andtolerance(the acceptable margin of error). - Universal Joining: The realization that physical connection and logical inheritance could be treated as the same "merge" operation provided a powerful, unified abstraction for system design.
- Planning for Performance: To enable real-time interaction, ThingLab "plans" the satisfaction of a set of constraints in advance. By saving this plan, the system can provide immediate visual feedback as a user drags a component across the screen, rather than re-solving the entire system from scratch at every frame.
Results and Applications
The system was successfully implemented and demonstrated across various domains, including digital logic gates, bridge trusses, and electrical circuits. A key result was the system's inherent extensibility. ThingLab contained no "built-in" knowledge of physics; instead, it provided a meta-framework that allowed users to define the laws of a specific domain themselves through the definition of constraints.
Limitations and Future Directions
While pioneering, the 1977 version of ThingLab faced several constraints:
- Scalability: The relaxation and assumed state methods were computationally expensive, limiting the complexity of simulations that could be run in real-time.
- Numerical vs. Symbolic Math: The system relied on numerical methods. Borning noted that incorporating symbolic manipulation would significantly enhance the solver's power.
- Advanced AI Techniques: The paper suggests that future iterations could benefit from "dependency-directed backtracking" to handle state changes more efficiently and improve the "black-box" modularity of complex sub-systems.
Summary updated