Case Studies

Freemind

We extracted the Freemind case study from the qualitas corpus. We made the hypothesis, from its name, that the freemind.common package is a package used throughout the remaining of the software. This package should thus be stable. To enforce this stability it should only depends on itself. This can be made explicit with the following Weland constraint:

hide all-freemind from common

where all-freemind is a set referring to every packages of freemind. An archive containing the sources of the freemind 0.9.0, the coupling constraint and the refactoring plan can be found here.

81 violations are found. We remove 77 of them in only 9 steps.

The remainging violations calls for numerous interfaces to be broken. We decided to stop the refactoring here. Once these operations performed, the code can be generated.

Screen

The Screen study case is inspired from a bridge design pattern example written by Jan Hannemann. It can be downloaded here. Conforming to the design pattern goal, which is to decouple an abstraction from its implementation, we devised the following constraint :

hide printers from screens

This example is taking care of much finer grain details than the previous one. The hidden elements are methods and not whole packages.
There are 8 violations to break. This is done by creating new classes to move the forbidden methods and introducing a common interface. Once all violations removed, several more transformations will make the bridge design pattern emerge.