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 ‘unnecessary-complexity’ Category
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 [...]
Unnecessary Complexity
Friday, 20 March 2009
A lot of the work I’ve done recently has involved substantial improvements to largish production code bases. Currently I’m working on a system of .Net apps that seems to have experienced exponential LOC growth in the few years of it’s development. Before that I was doing maintenance and upgrade work on an app that started [...]