Hi,
recently I have released a software called Clone Detective for Visual Studio (CodePlex). This tool allows you to find duplicated source code in C# projects. Although this is a very powerful tool it does
not prevent copy & paste coding before it happens; it can only detect it.
What do you do against this well known behavior? Code reviews? Better dev education? Aspect oriented programming (e.g.with
PostSharp)?
I believe code duplication is not always something one must fight. For example, our company sometimes intentionally duplicates source code in order to remove a dependency between two components. I think from time to time it is better to eliminate a dependency
instead of taking code reuse to the extreme. More dependencies make a system more complex and harder to support. On the other hand I have heard the Excel team at Microsoft has made a religion out of this -- they even have developed their own C compiler. I
believe this takes dependency elimination a bit too far. (to be honest, this story about the Excel could also be an urban legend
)
What do you think? How do you fight copy & paste? Do you fight at all?