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 [...]
Archives for the Month of May, 2009
Unnecessary Complexity Case Study #1: Untyped Enum Comparisons
Thursday, 7 May 2009
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 [...]