Novice Software Engineers Tend to Optimize Code by Decreasing Duplication

Software engineers early in their career tend to optimize code by decreasing duplication and applying the DRY (don’t repeat yourself) principle. However, this is not always the most valuable contribution, just the easiest optimization to spot. Over optimizing for decreasing duplication can lead to increased complexity of the program and more coupling which are more important concerns than duplication. One should optimize for reducing state, coupling, complexity, and then code.

  • Pareto Optimal

    Occurs when one party’s position can not be improved without loss to the other party. For example, in negotiations, that would the point where the terms are optimized for both parties such that it can not be improved further without loss to either side. A Pareto improvement is when something can be improved without loss and Pareto dominated is when there is a possible Pareto improvement.

  • Duplication over Abstraction

    It’s better to favor duplication over the wrong abstraction. The wrong abstraction starts out as a way to remove duplication and then gets altered over time to handle more and more conditions to the point where it’s unique to all the callers.

  • How to Make All Your Code Twice as Complicated

    The way to make everything in your codebase twice as complicated is to make data nullable.