The formula involved for calculating defect density is simply (number of defects) / (lines of code). So if lines of code would be less it increases the chances of having a high defect density. In other words, if in a project design principles are strictly follwed and all duplicacy, all dead code, all redundancy is removed, it will only lead to lesser lines of code. Now this might be called an optimized piece of code. But that does not help with the defect density parameter.
If one is working on a project, where ultimately defect density is to be calculated, wouldn't it lead the programmers to ignore code duplicacy and dead code ?
Is Defect density a valid technique at all ?