Code clone Discovery Based on Functional Behavior
by
Ronald M Krawitz
2012
Legacy programs are used for many years and experience many cycles of use-maintenance-use-maintenance-use-etc. Source code or source code functionality is frequently replicated within these programs when it is written, as well as when it is maintained. Over time many different developers with greater or lesser understanding of the source code maintain the source code. Maintenance developers, when they have limited time or lack understanding of the program, frequently resort to short cuts that include cutting and pasting existing code and re-implementing functionality instead of refactoring. This means a specific functionality is often repeated several times, sometimes using different source code. Blocks of replicated source code or source code functionality are called code clones. Removing code clones improves extensibility, maintainability, and reusability of a program in addition to making the program more easily understood.
It is generally accepted that four types of code clones exist. Type-1 and Type-2 code clones are comparatively straightforward to locate and tools exist to locate them. However, Type-3 and Type-4 code clones are very difficult to locate with only a few specialized tools capable of locating them with a lower level of precision.
This dissertation presents a new methodology that discovered code clones by studying the functional behavior of blocks of code. Code Clone Discovery based on Functional Behavior (FCD) located code clone by comparing how the blocks of code reacted to various inputs. FCD stimulated the code blocks with the same input patterns and compared the resulting outputs. When a significant portion of the outputs matched, those blocks were declared to be a code clone candidate. Manual analysis confirmed that those blocks of code were code clones. Since FCD discovered code clones based on their black-box behavior, the actual source code syntax was irrelevant and manual inspection further confirmed FCD located code clones that included Type-3 and Type-4 code clones which are frequently excluded from code clone detection tools. FCD recognized the code clones regardless of whether or not they use identical code, similar code, or totally dissimilar code. This new technique allows for an improvement in software quality and has the potential to significantly reduce the cost of software over its lifetime.
Identifer | oai:union.ndltd.org:nova.edu/oai:nsuworks.nova.edu:gscis_etd-1200 |
Date | 01 January 2012 |
Creators | Krawitz, Ronald Michael |
Publisher | NSUWorks |
Source Sets | Nova Southeastern University |
Detected Language | English |
Type | text |
Format | application/pdf |
Source | CEC Theses and Dissertations |
Page generated in 0.0019 seconds