CodeSOD: I saw the Vorzeichen
Chilly inherited a VB .Net application which generates an "IDoc" file which is used to share data with SAP. That's TRWTF, but the code has some fun moments:
If ldCashOut < 0 Then 'CashOut loE2WPB06002.vorzeichen = " "Else loE2WPB06002.vorzeichen = " "End IfIf liTRANSTYPE = 2 Then 'Refund is always Positive loE2WPB06002.vorzeichen = "+"End IfloE2WPB06002.summe = Math.Abs(ldCashOut).ToString 'CashOut loE2WPB06002.zahlart = "PTCS" 'CashOutloE2WPB06002.vorzeichen = "-" 'CashOut
If ldCashOut is less than zero, then we set a field to " ", if it's not less than zero... we do the same thing. But wait, if the transaciton type is 2, then we set it to "+". But then we set the same field to a "-", unconditionally.
Chilly describes this pattern as "if, else, eh screw it".
Chilly adds "in case you were wondering, the class and field names are abbreviated German words." This is amazing, as it extends my (very limited) understanding of the language. I'm not sure what loE2WPB06002 is short for, but I'm sure it's a beautiful, useful word, like "Donaudampfschiffahrtsgesellschaftskapitan" (Danube steamship company captain, which is clearly an important word in daily use).
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!