Tech2 News StaffSep 21, 2017 22:09:37 IST
Researchers from the Massachusetts Institute of Technology's (MIT) Computer Science and Artificial Intelligence Laboratory (CSAIL) have developed a system known as CodeCarbonCopy that allows software engineers to reuse snippets of code from one program in another. The programmer has to select the code from one program, and select an insertion point in another program, and the system automatically makes the necessary changes, such as changing the variable names from the source program to that of the target program.
Stelios Sidiroglou-Douskos, the first author of the paper says, "CodeCarbonCopy enables one of the holy grails of software engineering: automatic code reuse. It’s another step toward automating the human away from the development cycle. Our view is that perhaps we have written most of the software that we’ll ever need — we now just need to reuse it."
The researchers demonstrated the system in a series of eight experiments, where code was transplanted between six open source programs. The code worked as intended in seven out of the eight programs. First, an input file is fed into both the programs, and the system identifies the variables that play the same role in both the programs. This process is used to match the variables from the source program to the target program. The system can also find out the relationships of the values stored in two programs, and generate a set of operations to translate from one representation to the other.