A new system from MIT's CSAIL, or Computer Science and Artificial Intelligence Laboratory, does something incredible to fix buggy software: It borrows healthy code from other applications -- and then fixes the bug without ever accessing the original source code.
Think of it as an organ transplant. Except in this case, the sick patient is a buggy software app. And the "donor organ" is a piece of code from another application, even if it's written in a whole different language. That's a crude and imperfect metaphor, but it helps explain CodePhage, a system that was presented by MIT researchers at the Association for Computing Machinery's Programming Language Design and Implementation conference this month, as MIT News explains today.
CodePhage's creators explain it like this: A program with a bug is the "recipient". When CodePhage identifies a bug, it searches for a fix from a slew of other programs and repositories. Once it finds a good piece of "donor" code, it patches it onto the recipient and tests whether it fits -- without ever gaining access to the source code. It keeps doing this until it finds the ideal donor.
What's really cool about this system is that it can fix bugs using solutions that might not even be written in the same language, creating a kind of patchwork of good ideas from a broad range of sources. You can find a full run-down of how CodePhage works in this presentation by one of its creators, Martin Rinard, but to MIT News Rinard explained how CodePhage is part of a broader effort to create a system that will reduce the need for new code completely:
"The longer-term vision is that you never have to write a piece of code that somebody else has written before," Rinard says. "The system finds that piece of code and automatically puts it together with whatever pieces of code you need to make your program work."
The intricacies of how the system checks and re-checks its fixes using a symbolic expression are complex, of course, but even from a layperson's perspective it's easy to see how a system like CodePhage could be a forerunner to systems that are constantly finding and patching bugs, drawing on the collective intelligence of multiple authors and sources to built better applications.
For more, check out MIT News's writeup.