r/programming • u/blore40 • Jul 30 '15
Code 'transplant' could revolutionise programming (Wired UK)
http://www.wired.co.uk/news/archive/2015-07/30/code-organ-transplant-software-myscalpel
0
Upvotes
r/programming • u/blore40 • Jul 30 '15
22
u/Strilanc Jul 30 '15 edited Jul 30 '15
This article is garbage with no useful details beyond the terminology the researchers happened to use.
That being said, the underlying idea sounds really interesting. Use the implementation of feature X in program A to auto-implement X in another program B. After skimming the actual paper, here's the general idea:
The programmer marks the functionality-to-extract in the source program by marking a function with an
/* OE */comment. The function doesn't have to be pure; it can touch globals and have side effects.The programmer annotates an
/* IP */at the desired insertion point in the destination program.There must be a good existing test suite for the destination program's existing features.
The programmer must provide new tests that exercise the expected-to-be-inserted functionality in the destination program.
The tool tries to make the new tests pass, without breaking the old tests, by adding code at the insertion point. The "extraction point" function acts as a hint / code snippet source to help the process along.
You still have to write the tests, and the code that gets inserted probably isn't very clean, but in the ideal world where this worked perfectly it'd be a nice 2X speedup in dev time. Definitely interesting.