Duplicate code is an unwelcome, but common occurrence in software design where a similar/identical set of instructions exists in several parts of the software source code. Duplicate Code Detection (DCD) helps to automatically discover the duplicate code from a large selection of source code so that redundancies are appropriately flagged, justified, or eliminated. DCD provides a means for software developers to identify such redundancies, with the short-term goal of assessing the code quality of a large program, and ultimately the goal of refactoring the code. This is very applicable in the context of mainframe COBOL programming, where very large code databases (millions of code lines) have evolved over a period of time, as maintenance becomes very demanding.
We launched our first TechPreview in March ’20. We have followed it up with two refreshes. Our first refresh was delivered in June, with our follow-up being delivered this month (Nov ’20). Additional details on our Duplicate Code Detection Technology Preview can be found here.
Here is a summary of what Duplicate Code Detection can do:
1.Identifies code fragment for Type 1 duplicates
- Type1 : Identical code fragments except for variations in whitespace, layout and comments.
2.Code refactoring without changing external behavior
- Improved code readability
- Reduced complexity
- Rationalize source code
3.Discovery from a large selection of source code
- Custom fragment length & search scope
- Reliable searches
4.Share duplicates with team members
- Search your Source Code Manager (SCM)
- Version & share search results
5.Provide global refactoring action to create COPY from duplicates (this allows users to create a copybook and call it in all the resources concerned in a duplicate)
6. We've also included new enhancements to the user interface. You'll find new functionalities like:
- A tool-tip for each clone returned,"Add More" and "All" buttons in the duplicate details view, and much more...
We must reiterate that your feedback is valuable to us. We encourage you to vote on existing enhancements or submit your own enhancement request,
here.
And finally, we leave you with Bob Reselmen’s very informative blog on Duplicate Code Detection – DRY comes to COBOL