October 10, 2006

...Learn TDD with Codemanship

Impossible Models

Every so often I chance across UML models that are, how shall we say, syntactically correct but semantically impossible. That is to say, we could never create a valid instance of the model.



In this example, a Person must have exactly two parents, and yet cannot be one of its own ancestors. It is not possible to create a valid instance of this model, since this rule defines an acyclic graph (no element can be directly or indirectly connected to itself) that means that in any instance there must be at least one Person that has less than 2 parents.

Although the UML model is impossible, we know that every person really does have two parents, and so we have to ask ourselves if UML is adequate to express such rules. The way it works in reality is that the type Person has been evolving, and there was a time when two not-quite-people had offspring that were just-about-people. It's a silly example, but it illustrates some of the limitations of the simplistic, set-theoretical foundations of logic languages like UML. Reality is not as crisp and clear, and real-world types don't have the well-defined "it either 100% is or it 100% isn't" boundaries that abstract data types have in computing.

In practice, this means that most computer models are at best snapshots of approximations of a complex and evolving world, and by their very nature they are inherently out of date and need constant maintenance to keep them close enough to the reality to be useful.

One solution might be fuzzy types, where set membership is by degrees, and rules are therefore expressed in shades of grey. Types could also be allowed to evolve, making it possible for software to adapt itself in a more liquid sense of the word.
Posted 14 years, 2 months ago on October 10, 2006