When Mike's manager asked if he'd like to take a stab at doing some maintenance on the Freight Calculator, naturally, he agreed.

After all, like many manager requests, it's not  like he really had a choice in the matter, though Mike sorely wished that he did.  The Freight Calculator, a MS Access/VBA "app", was previously maintained by a former fellow developer named Trent who had moved on to supposedly greener pastures a few weeks earlier.  Like many in the department, Mike often heard Trent cursing under his breath any time he walked past so his departure was not at all unexpected.  Though Trent was the only developer who had delved into the inner workings of the Freight Calculator, it already carried a reputation throughout the department as being a nightmare application to support.  A reputation that Mike soon witnessed as being well earned. 

Absent of any outside oversight or input, its functionality seemed to more closely resemble a cup of noodles than a "calculator".  Though knowing the history second-handed, Mike didn't necessarily blame Trent for how the logic flowed, but one detail that did stick out.  The variables were often given incoherent and inconsistent names, and in many cases, vowels were dropped from names where they should have belonged.  Maybe he felt that by not using vowels it would be a cost savings for the company Mike chuckled to himself

Mike was all set to do a global Find-and-Replace on the scripts until he opened a module named simply "Variables".  Now, the fact that this file was overflowing with literally hundreds of global variables is a true WTF, but instead, much like finding a beautiful field of flowers growing near Chernobyl, what he saw was actually...beautiful.

Public AT1 As Long
Public GetB As Long
Public PradPs As Long
Public Geta1ID As Long
Public StringID As Long
Public ProformID As Long
Public CreatedID1 As Long
Public TickerTal1s As Long
Public InvalidCount As Long
Public PrmID, ImptID As Long
Public EnID, InvaldID As Long
Public RdID, RefundedID As Long
Public OffWeightedSum As Currency
Public B11CFee, PortFee As Currency
Public RSDPctAr, FoldPct As Currency
Public DS1, DS2, DS3, AS4 As Currency         
Public RV1, RV2, RV3, BSS4 As Currency         
Public FFF, NCF1, BB1, B1A As Currency
Public InvldMet, FER, AS1 As Currency
Public RevUpPct, RvUpPost As Currency
Public EscA, EscB, InvaldT As Currency
Public RSDFee, FedFee, R5Fee As Currency
Public StripTot, StripTotalPct As Currency
Public ValPrt, PretextVar, G1, R1 As Currency
Public PartAff12, affixedMost, GRat1 As Currency
Public ProsDirty1, ProcSpl, CartSplit1 As Currency
Public PC5A, PC3A, PC4A, P3B1, PCU, PCR As Currency
Public DC5, DC3, DgCA, DcM, DCB, DCU, DCR As Currency
Public rptAffordeD, raptCapped, rptPostand As Currency
Public B5DP, B3DP, BMAP, BARP, BUPP, BREP1 As Currency
Public RftUpPct1, RftUpPosted1, RftUpPat2 As Currency
Public GtQ5, GtQ3, GTQA, GTQM1, GTQB1, GQU As Currency
Public Var1, Var2, Var3A, VarM1, VarU4, VAR As Currency
Public Save2S, Save3A, Save4A, Save5A, Save12 As Currency
Public Gubr2, GUBR1, GubrA, GubrB, GubrC, GubrU As Currency
Public Disr1A, DISR3A, Disr5, DisrB, DiscrA, Disr6 As Currency
Public Port1, Port3, PostA, PostB, Post2, Post3, PostD As Currency
Public PosandAllowd, PosandStopd, PortandDue, Serv1scart As Currency
Public rptPrt4, rptPrt6, rptPrtJ1, rptPrtI, rptPortB, rptP As Currency
Public Disc7Sum, Disc8Sum, DiscB4Sum, DiscUJSum, SaveWSum As Currency
Public Port6Sum, Port9Sum, PortB4Sum, PortHSum, PortHSum As Currency
Public Prod2, Prod1, Prod3, ProdH, ProdE, ProdB, ProdQ As Currency
Public ProdR, ProdM, ProdN, ProdFD, ProdRSD, ProdD1H As Currency
Public PercentJS, PercentJ7, PercentJ5, PercentJ1 As Currency
Public PercentB, Percent35U, PercentU, PercentR As Currency
Public PercentF, PercentD, PercentRSD, PcentD1H As Currency
Public Prod7Sum, ProdBBSum, ProdAM1Sum, ProdBSum As Currency
Public ProdRLSum, ProdRSum, ProdRSDSum, ProdR06Sum As Currency
Public ProdP, ProdPSum, ProdRSum, ProdTSum, ProdFSum As Currency
Public soldG, Sold12, soldB, SoldX, SoldY, soldZ, sold44 As Currency
Public soldU, soldPU, SoldH, SoldI, SoldJ, SoldN, SoldF, soldUP As Currency
Public SoldRAS, SoldR11, SoldR12, SoldR13, SoldD1, SoldD2, SoldSP, SoldPC As Currency
...(and so on for a few dozen more lines)...


[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!