It Will Never Work in Theory

Example Embedding

Posted May 2, 2012 by Leif Singer

| Education | Practices |

Ohad Barzilay. "Example Embedding", Onward! 2011.

Using code examples in professional software development is like teenage sex. Those who say they do it all the time are probably lying. Although it is natural, those who do it feel guilty. Finally, once they start doing it, they are often not too concerned with safety, they discover that it is going to take a while to get really good at it, and they realize they will have to come up with a bunch of new ways of doing it before they really figure it all out.

After we had an interesting discussion with input from industry a few weeks ago with the paper "Component reuse vs. snippet remixing", I want to follow-up in that direction with another perspective. Apart from the hilarious abstract, it is a paper that reads well and entertains. In addition, it sheds some light onto a common, yet shunned practice.

From time to time, developers use example code from the Web in their own code. In his essay, Barzilay lays the foundation for talking about this phenomenon and identifies the elements of that ecosystem. For example, he mentions what kinds of sites are used by developers and what the process of reusing an example can look like. Addressing concerns from the Component reuse vs. snippet remixing paper, he discusses potential solutions for making the practice safer and more systematic. Finally, as an interesting analogy, Barzilay contrasts example embedding with academic practices.

While the use of examples from the Web may be looked down upon by several developers, it is a pervasive practice. Yet, neither industry nor research provide comprehensive support for making it safer. Barzilay's essay helps us understand what the example ecosystem looks like and gives us ideas for possible solutions of its problems.

Finally: thanks to Jorge, Neil, and Greg for having me here at NWIT!

Comments powered by Disqus