At a conservative estimate, I have written a quarter of a million lines of Prolog code to date. Most of it was a waste of time because it got filed in an archive somewhere and when I needed to write the next batch of code I pretty much wrote it all from scratch again. Why? Because there was no quick and simple way for me to re-use the bits I needed from the old code (quick and complex, as in "programming by example" and "techniques editing", though interesting in theory doesn't get used in practice). I'm an average programmer so multiply this by the number of middle-aged, average Prolog programmers in the world and you see the problem. I shall discuss two different ways of doing something about this. The first is highly selective about what it extracts (ontological constraints) and is driven by percieved demand in the knowledge engineering community. The second is general-purpose and is not driven by the demands of any particular group of people, so it probably isn't useful in practice but it does change the way one views coding so it is worth describing. There are initial implementations of both methods.