Pragmatic software reuse

Many software reuse tasks involve reusing source code that was not designed in a reusable manner. These pragmatic reuse tasks arise for a variety of organizational and technical reasons. To investigate a pragmatic reuse task, a developer must navigate through, and reason about, unfamiliar source code in order to identify those program elements that are relevant to his reuse task and to decide how they should be reused. Once these elements have been identified, the developer must convert his mental model of the task into a set of actions he can perform. These tasks are poorly supported by modern development tools and practices. The thesis of this dissertation is that by providing developers with a mechanism to create pragmatic reuse plans in a structured way, and a methodology to semi-automatically perform the pragmatic reuse task using this plan, we can enable developers to perform pragmatic reuse tasks more quickly and with greater confidence. To validate these claims we have created a model that captures the program elements involved in a pragmatic reuse task, along with annotations that correspond to the developer's decisions about how an element should be treated in a reuse task; the model explicitly enumerates each of the actions required to perform a pragmatic reuse task. We have created a tool, called Gilligan, that allows developers to create pragmatic reuse plans by navigating through unfamiliar source code and annotating its structural elements corresponding to how they should be treated in a reuse task. Using this plan, Gilligan can semi-automatically transform the source code from its originating system and integrate it into the developer's system. We have evaluated Gilligan using a series of case studies and experiments using a variety of source systems and tasks. The results show that pragmatic reuse plans are a robust metaphor for capturing pragmatic reuse intent and that Gilligan can significantly decrease the amount of time developers require to perform pragmatic reuse tasks.