Each year, whenever summer weather faded and the air started to turn brisk, Craig knew that it could mean only one thing - a new round of interns would be arriving in the department. Sure, some were markedly better than others, but a little bird had mentioned to Craig that his intern-of-the-year actually had some coding experience on his resume!
Maybe this was why Craig let his intern run loose with what he had considered a simple spec. It was meant to be a learning task. You know - get familiar with checking code in and out of source control, explore the code base, and so on. The result? A 2,300 line source file named "Functions".
Eager to see what hell his intern hath wrought, Craig nervously opened the source file and came across these two methods sitting right next to each other.
public static string HumanLogic(object data) { string result = "No"; if (Logic(data)) { result = "Yes"; } return result; } public static string BoolToYesNo(object data) { string result = "No"; if (Logic(data)) { result = "Yes"; } return result; }
Hoping to be a helpful mentor, and curious to find out if his intern was under the influence of one or more controlled substances, Craig arranged a meeting to review the code.
Craig constructively explained where improvements could be made and when asked why he took the above approach, his intern matter-of-factly replied, "Well, I didn't want to wear out the first one by using it too much."