Matt was thrilled.

Finally, at long last, he had received the opportunity to rewrite one of the company's most overly complicated, fault intolerant, and important services. Over the years, it had achieved a "widowmaker" status where it was famous for crashing whenever it encountered one bit of uncommon (like accented characters) or mis-keyed data, often at the most busiest periods. There was talk among the teams for years of re-engineering the process but, because of its reputation, the code was deemed too gnarly and therefore too costly to fix...until now.

During the process of familiarizing himself with how the crooked internals worked, Matt ran across this gem, found within a method suitably named the ScrubbingBubble class - a section of code that, according to the header, was allegedly responsible for cleaning up bad data.

public static string ScrubCustomerName(string name)
{
  string newName = string.Empty;
  if (string.IsNullOrEmpty(name))
    newName = null;
  else
    newName = name;
  return newName;
}

There were also other elements to the ScrubbingBubble class too - ones responsible for "scrubbing" each address field, another for "scrubbing" the phone number, and many more, all responsible for "scrubbing" customer data and, surprise! They all followed the same anti-pattern.

After digesting the ScrubbingBubble class, Matt moved onto deciphering how the rest of the code worked and thought to himself, One mystery scrubbed...many more to go.