Archives for the Month of May, 2009

Code Clones

Code clones are code constructs or functionality that is repeated throughout a system.  It’s a well documented problem.  In short, the issue is duplication of logic.  Take this example: double Area(double radius) { return 3.14*Math.Pow(radius, 2); } double ComputeArea(double radius) { return 3.14*Math.Pow(radius, 2); } Two functions identical in every way except name.  The cost of [...]

Unnecessary Complexity Case Study #1: Untyped Enum Comparisons

This post is the first in a series of posts on specific examples of unnecessary complexity.   Consider this code: enum MyEnum  { First, Second } public void Match1(MyEnum e) {     if (e.ToString() == “First”) { } } The problem lies in the condition of the if.  The developer is converting an enum instance [...]