Test Driven Code Reuse
Colin Atkinson and his research group, in the Software Engineering Department at the University of Mannheim, have created merobase, a tool that allows the user to search the internet for existing code that matches a given interface (structure). That’s fine, but not really unique, there are other search engines that perform a similar service – such as Google Code Search.
What distinguishes Atkinson and his students, Oliver Hummel and Monika Krug, is that they have have added an additional capability – the ability to search not only on structure, but also behavior. This is accomplished by using tests written by the developer to be part of the search criteria. All classes that match the required interface are then run against the tests provided.
Monika has written an Eclipse plug-in called FAST (Fully Automated Search and Test) that will automatically parse and query merobase based on tests that you’ve written. So, you write your tests, right-click on the test class, and automatically retrieve all applicable classes from the internet that match your criteria.
Here is an example test written for a Die class:
This is FAST in action:
Here is an example of a Die class returned from FAST:
This is a research project currently, but it can easily be imagined how useful this approach can be for large organizations that have tens of millions of lines of code hanging around that can now be searched and reused without the cost of frameworks and abstractions that are difficult to understand, use, and maintain.
Todd Montgomery Dec 19, 2014