Archives for the ‘unnecessary-complexity’ Category

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 future [...]

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 to a string for the purposes of [...]

Unnecessary Complexity

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 [...]