The context for generative code, in the work of Christopher Alexander, is in built environments, and directly related to Morphogenesis.
A generative code is a system of explicit steps, for creating [a social-spatial] fabric. It defines the end product, not by specifying the end-product itself, but by defining the steps that must be used to reach the end product. Unlike a process which defines the end product, and then leaves the getting there to the developer, the processes initiated by a generative code assure that the end product will be unique each time it occurs, and will be unique in just the ways that matter.1
1This approach to building is based on morphogenesis, which has been the basis of Alexander’s work throughout his career as architect, planner, educator, theorist and builder. The theory, connections to other fields of science, and hundreds of examples of putting this theory into action are covered in the four books of The Nature of Order, Alexander’s recently completed four-volume work.
The specificity of context for generative code as developed by Christopher Alexander calls for deeper investigation for reuse in broader contexts.
Christopher Alexander, Randy Schmidt, Brian Hanson, and Michael Mehaffy. 2005. “Generative Codes: The Path to Building Welcoming, Beautiful, Sustainable Neighborhoods.” http://www.livingneighborhoods.org/ht-0/generative.htm