Self-assembly is the phenomenon in which a collection of particles spontaneously arrange themselves into a coherent structure. Self-assembly is ubiquitous in nature. In this article we consider the task of programming active self-assembling and self-organizing systems at the level of interactions among particles in the system. To demonstrate the approach, we use it to control an experimental system called the programmable parts testbed (PPT). We also consider several illustrative examples, including polymerization, a model of a molecular ratchet, and a cooperative control scenario. In all of these systems, we provide each particle or robot with a local interaction rule book called a graph grammar.