"I recently started a new job," writes D.Z., "and one of my tasks is to maintain a $DEITY-forsaken piece of software, written originally in VB.NET, then mutated and mutilated into C#."
"Generally speaking, I don't mind working on badly designed and poorly written applications. In fact, I've found it to be a fun challenge to dive head-first into spaghetti code and straighten it out as best as I can. It's like being an archeologist who tries to extract knowledge from a bunch of incoherent paintings on a cave wall... just without the adventures and, of course, the fedoras.
"The one thing that annoys me the most, diluting my maligned enjoyment of bad code is really long method names. I'm not talking about just any long_but_legible_name, nor of VeryExplicitMethodNames. Oh no, that would be fine with me. What I'm talking about are ExtremelyLongMethodNamesThatForceYouToScrollYourEditorWindow and VeryExplicitNamesThatTellYouEverythingYou-NeedToKnowAboutTheMethodButWhichYouWillForgetByThe-EndOfTheLineAndProbablyAreInnacurateAnywayBecauseTheCodeWithinHasChangedSince.
"Phew! Below are a couple of examples from one of this app's classes...
private void SetDefaultValueForCheckboxForUpdatingMainEmployeeRecordAndFutureBenefits(DateTime benefitDate) { if (benefitDate < DateTime.Today) { chkApplyUpdateToMainAndFutureRecords.Checked = false; } else { chkApplyUpdateToMainAndFutureRecords.Checked = true; } }
And a property...
public bool UpdateMainEmployeeRecordAndFutureBenefitRecords { get { return m_updateMainEmployeeRecordAndFutureBenefitRecords; } set { m_updateMainEmployeeRecordAndFutureBenefitRecords = value; } }
And one that hasn't quite made it from VB.NET yet...
Sub DetermineWhetherToLinkToAParticularBenefitForEligibilityAndSampleCriteria() sampleCriteria_KeepInSyncWithEligibilityIfEligibilityDisplayingRecentBenefit = Eligibilities_UseBenefitSpecificAssignments ' ...SNIP! Dim weAlreadySearchedForARecentBenefitForTheEligibilityLink As Boolean = False If displayEligibilityInfoOnMyPrecinctPage Then GetRecentBenefit(PrecinctID, recentBenefitFormula_DaysInPast, recentBenefitFormula_DaysInFuture, False) weAlreadySearchedForARecentBenefitForTheEligibilityLink = True If (recentBenefit_BenefitID <> -1) Then sampleCriteria_KeepInSyncWithSamePageInfoWhenNotInSyncWithEligibilityLink = True End If ' ...SNIP! ' this goes on for about 150 more lines... HideSampleCriteriaLinkOrShowUnavailableMessage() ' ...SNIP! End Sub