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-myscalpel11
u/hu6Bi5To Jul 30 '15
So a piece of code could be shared and used by multiple pieces of software? This is revolutionary! I have never heard of such things...
5
2
u/neofatalist Jul 30 '15
How about transpilers / cross compilers or middleware?
12
u/_hmmmmm Jul 30 '15
Think of the possibilities... we, we could even invent a vast network a machines that can talk to each other that spans the globe!
7
7
u/htuhola Jul 30 '15
Here's more useful link: http://crest.cs.ucl.ac.uk/autotransplantation/index.html
6
u/TheBuzzSaw Jul 30 '15
I had to check to make sure I wasn't reading The Onion. Not only is the idea kind of boring sounding (code reuse... with the help of a robot), I always have to raise an eyebrow whenever people try to claim ahead of time that project X will revolutionize industry Y.
6
u/ErstwhileRockstar Jul 30 '15
It's a prank, an academic hoax. Basically, a new name for copy/paste.
4
u/IbanezDavy Jul 30 '15
Brilliant! Now to finish my work on a coding paradigm that allows you to create hierarchical relationships between data sets.
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.