A new system from Massachusetts Institute of Technology's (MIT) 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 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.
CodePhage’s creators explain it like this: a program with a bug is the “recipient”. When CodePhage identifies a bug, it doesn’t even need to access the source code of the recipient: it just searches for a fix from a slew of other programs and open source databases. Once it finds a good piece of “donor” code, it patches it onto the recipient, and tests whether it fits. It keeps doing this until it finds the ideal donor.
What’s really interesting about this system is that it can fix up other applications without having access to them, using solutions that might not even be written in the same language. 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 write-up.