InfoQ

News

Test Driven Code Reuse

Posted by Amr Elssamadisy on Sep 18, 2007 04:00 PM

Community
Java,
Agile
Topics
Reuse
Tags
Eclipse,
JUnit
Code reuse has been the holy grail of software development for a long time. Historically we've tried to achieve code reuse through abstractions and frameworks, which came with their own technical debt. There is now a novel approach that leverages the power of search tools and automated developer tests to search open-source code for matches against interface and behavior.

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.

Related Sponsor

VersionOne is recognized by Agile practitioners as the leader in Agile project management tools. Companies such as Adobe, BBC, CNN, Dow, HP, IBM, Sony and 3M have turned to VersionOne to help deliver greater value to their customers.

2 comments

Reply

Cute by Steven Devijver Posted Sep 19, 2007 4:14 AM
Re: Cute by Luis Garcia Posted Sep 19, 2007 6:46 AM
  1. Back to top

    Cute

    Sep 19, 2007 4:14 AM by Steven Devijver

    Cute. I'm wondering though how it tests code on the effects of unspoken leaky abstractions.

  2. Back to top

    Re: Cute

    Sep 19, 2007 6:46 AM by Luis Garcia

    That's where AJAX voting stars come in.

Exclusive Content

Rob Windsor on WCF with REST, JSON and RSS

WCF is not just for SOAP based services and can be used with popular protocols like RSS, REST and JSON. Join Rob Windsor as he introduces WCF 3.5 and its new native support for non-SOAP services.

Christophe Coenraets Discusses Flex 3, AIR, and BlazeDS

Christophe Coenraets discusses Flex 3, Flex Builder, AIR, BlazeDS, Adobe and open source, integrating Flex with existing applications, and integrating RIAs with search engines and browsers.

Debunking Common Refactoring Misconceptions

Danijel Arsenovski attempts to dispel some of the myths around refactoring and how it applies to .NET developers.

REST Eye for the SOA Guy

In this presentation, recorded at QCon San Francisco, CORBA guru Steve Vinoski explains REST from the view of someone who comes to SOA from a traditional, RPC-oriented background.

Choose Feature Teams over Component Teams for Agility

Feature teams are key to scaling agility for large teams. In an excerpt from "Scaling Lean and Agile Development," Larman & Vodde show how feature teams resolve traditional problems & raise new issues

Billy Newport explains Virtualization

Billy Newport talks about virtualization, eXtreme Transaction Processing (XTP) and WebSphere Virtual Enterprise. He discusses hardware, hypervisor, JVM, application and data virtualization.

Virtualization and Security

While virtualization provides many benefits, security can not be a forgotten concept in its application.

Introduction to Agile for Traditional Project Managers

This session is specifically aimed at traditionally trained project managers who are new to Agile, and who would like to be able to relate the PMI's best practices to their Agile equivalents.