A new system has been created by researchers at MIT’s Computer Science and Artificial Intelligence Laboratory (CSAIL) that will enable programmers to transfer code from one program to another. All the programmer has to do is simply select the code from one program and choose where to insert it in the next. Then, the system will do all the necessary modifications to ensure it works correctly in the new program.

This remarkable new system has been nicknamed CodeCarbonCopy and was showcased recently at the Association for Computing Machinery’s Symposium on the Foundations of Software Engineering. “CodeCarbonCopy enables one of the holy grails of software engineering: automatic code reuse,” confirmed Stelios Sidiroglou-Douskos, a research scientist at CSAIL and first author on the paper. “It’s another step toward automating the human away from the development cycle.”

A total of eight experiments were carried out by the researchers where they used CodeCarbonCopy to transfer code between six of the most popular image-processing programs. Out of the eight transfers, seven were successful with the new program functioning as it should. With CodeCarbonCopy the first step in transferring code is to give both programs the same input file. The system then has a chance to compare how each program processes the file. With this information intact, the system identifies any correspondences between the variables and presents them to the user. It also presents any variables it was unable to find matches for in the recipient together with the variable’s original definitions.

In order to map these data representations across programs, CodeCarbonCopy examines the values that both programs store in its memory. Then, if a systematic relationship is found between the two programs it will generate a set of operations for how to go about transferring the code. This system can be used for file formats such as images and with programs such as image processors. Moving forward, the researchers will be looking at a way to generalize their approach to allow more flexibility and can use data structures other than arrays.

More News to Read