It seems like the more I read about different development models, the more I see overlap between the different paradigms. Even if you aren't using one of them for a given project, just knowing about all of them makes your code better because you realize how to make your code more testable.
One thing that has piqued my interest of late is theories in JUnit 4.4+.
Overview
In JUnit, the still experimental theory functionality is derived from the open-source Popper project. The name comes from Karl Popper's work on the philosophy of science. He was a major proponent of saying that something isn't scientific unless it is falsifiable, and that theories cannot be proven correct, merely shown to have exceptions. If someone can provide an exception, it means that the theory does not match all of our observations. Theories are models of the world, so while a model may not be correct, it can still be useful.
So what are theories in software good for? When using test-driven development, the tests serve as a form of code documentation. However, there are certain properties of code that are known or assumed by the developers that are difficult to codify as simple tests. Theories provide a simple and expressive means for at least the following cases:
- identities and data conversion
- globally disallowed behavior
- data that should be preserved after performing an operation or set of operations
For example, you might have a theory that data that is serialized into XML and then unserialized should always result in the original object. This seems to make sense, but it might be time-consuming or error-prone to specify all of the different tests that you have to consider. A single theory can codify this assumption.