Same Tool

Same is a tool to find duplicate lines in multiple text files. Very useful to find and fix CopyAndPasteProgramming. It has been designed by MarnixKlooster to be simple, portable, and fast.

see http://sourceforge.net/projects/same

an EmacsLisp mode is also available at http://ch.twi.tudelft.nl/~mostert/lisp.html made by JeroenMostert

See also: tools with similar goals: CategoryDuplicationFindingTool


(Originally on OnceAndOnlyOnce:)

Indeed it is possible to build a tool for mechanically removing duplicated methods and code - I built such a thing for the language Self (see http://www.guruinfo.co.uk). The tool did as much refactoring of duplicated code as it could, without manual intervention to tell the tool what made sense. A lot of the time the results were surprisingly good; hierarchies constructed by this tool were often just what you'd expect, showing that basing hierarchies simply on removal of duplication leads to 'good' hierarchies. The results of trying to automatically refactor methods was (even) more contentious though. For example, although '+ 1' is duplicated a lot, do you really want to replace it with a method called 'incremented' (or something similar) just so that the concept of incrementing is expressed only once? --IvanMoore

Funny, while working on a recent project, I did exactly that. If the '+ 1' is happening frequently on the same object, it probably wants to have such a method... at the very least, it might better explain what '+ 1' represents: next element of a list? next highest priority? one second less till doomsday? :) --WilliamUnderwood


See http://www.xpdeveloper.com/xpdwiki/Wiki.jsp?page=SameTool for a fork of Same that is faster and scales better when you have to handle hundreds of thousands of lines of code.


CategorySoftwareTool CategoryDuplicationFindingTool


EditText of this page (last edited December 22, 2003) or FindPage with title or text search