InfoQ

News

Test Driven Code Reuse

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

Community
Java,
Agile
Topics
Reuse
Tags
JUnit ,
Eclipse
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.
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.

Educational Content

Bindings, Platforms, and Innovation

This presentation focuses on the Internet and separating myth from fact, history from the future, and the mundane from the imaginative. Bob Frankston presents a vision of what could and should be.

Orchestrating Long Running Activities with JBoss / JBPM

This article explores the use of JBoss and jBPM to implement design solutions that effectively address the issue of orchestrating long running activities.

Neo4j - The Benefits of Graph Databases

This presentation covers the use of graph databases as an optimal solution for data that is difficult to fit in static tables, rapidly evolving data or data that has a lot of optional attributes.

Realistic about Risk: Software development with Real Options

This session introduces Real Options and shows how it can help in running your project. Real Options is a decision-making process that can be used to manage risk.

Communication Flexibility Using Bindings

This article discusses the use of bindings on services and references (including the instance of non-configured bindings) as the means to implement SCA communications in a Web and SOA environment.

Writing DSLs in Groovy

After a short introduction to DSLs, Scott Davis plays with the keyboard showing how to approach the creation of a DSL by typing working snippets of Groovy code that get executed.

Scaling Agile with C/ALM (Collaborative Application Lifecycle Management)

IBM Rational and InfoQ present, Scaling Agile with C/ALM, an eBook showing organizations how to become “finely tuned software delivery machines” by enabling team integration and scaling.

Concurrent Programming with Microsoft F#

Amanda Laucher presents a real life enterprise application written in F#. She shows actual code snippets, explaining design decisions and suggesting how to use some of the F# constructs.