For a class I'm taking I've been reading a couple of papers on runtime generation of classes. You need this if you don't know upfront how many classes, or even which classes you'll need. There are a couple of solutions for this problem. Most interesting is the "UML Virtual Machine":http://www.riehle.org/computer-science/research/2001/oopsla-2001.html. By now you'll have heard of virtual machine. A virtual machine is a program that reads a program written in some low-level intermediate format and executes it (or translates it to native machine code of the underlying platform and then executes it). A Java virtual machine, for example, executes the Java bytecode that the Java compiler generated.
The UML virtual machine executes "UML models":http://www.omg.org/uml/. UML stands for Unified Modelling Language and is a set of methods to visualize software designs. The most well-known of these methods is the class diagram which looks something like this: But there are many kinds of diagrams, including ones to model behavior in some situations. UML is used as a specification and communication tool. In a usual software project there's one or more architects that first specify how the application will work and how the different parts will be working together. After this architecting phase is done -- resulting in a specification -- the programmers will use this spec to implement the actual product. Managers don't like seeing code, they like images. That's why UML can also be used to show managers how the software will be organized and how it will work. So UML is a communication tool aswell.
The UML Virtual machine sort-of eliminates the implementation phase. It will just take the UML diagrams and execute them. Just like that, no code generation or anything. As of now this UML VM still has its restrictions. UML is a modelling language and not all behaviour can be specified unambiguously (without multiple interpretations), therefore in some cases logic still has to be written in a programming language like Java and plugged in. Still, I think it's an interesting development.
You can find the "full paper here":http://www.riehle.org/computer-science/research/2001/oopsla-2001.html, but I'll warn you upfront: most of it is about the implementation of this virtual machine, which isn't like grade-school math.