Susi inherited some code which she fortunately wasn't expected to maintain. She had a worse problem: she was expected to figure out what it did so that a new version of the software could be created. No one actually understood all the ins-and-outs of the software, there was no document that fully specified what it did, but it was absolutely business critical and every feature needed to continue to work, even if no one knew exactly what those features were.

Features and functionality aside, internally, everything was stringly typed, and I do mean everything. Why use a struct in C++ when you can use a character delimited string? Why use a class when you can instead use multiple different kinds of delimiters to mean different things? Susi found cases where they stretched to delimiters involving characters Susi didn't even know existed, like the double o̿verscore.

This block doesn't use any unusual delimiters, but it doesn't make it any easier to understand.

CString CUtils::IsTokenRangeEmpty(CString strNumbers,const CString& strLine) { if(strNumbers.Find(',')==-1) strNumbers+=","; CString str1,str2,str3; int i=0,nBis,j; if(strNumbers.Find('-')>=0) { while(AfxExtractSubString(str1,strNumbers,i,',')&&!str1.IsEmpty()) { if(str1.Find('-')>=0) { AfxExtractSubString(str2,str1,0,'-'); j=atoi(str2); AfxExtractSubString(str2,str1,1,'-'); nBis=atoi(str2); str3=""; for(;j<=nBis;j++) { str2.Format("%d,",j); str3+=str2; } str3.TrimRight(","); ReplaceToken(strNumbers,i,str3,','); } i++; } } i=0; while(AfxExtractSubString(str1,strNumbers,i,',')&&!str1.IsEmpty()) { if(GetToken(strLine,atoi(str1),true).IsEmpty()) str3=""; else str3.Format("%d",atoi(str1)+1); ReplaceToken(strNumbers,i,str3,','); i++; } ReplaceAll(strNumbers,",,",","); TRIMBOTH(strNumbers,','); return strNumbers; }

"I still don't know what it does," Susi writes, "and I don't want to."

It definitely appears that the original developer was working at making sure Susi didn't know what it was doing, with such wonderful names as str1 and str3. Nothing in the code or the comments explains how the "-" and "," delimiters are used, or what data we're extracting. It takes an strLine parameter which it doesn't use, but it doesn't use it by reference. Most important, though, is the method is called IsTokenRangeEmpty, but it's not a boolean function: it's extracting strNumbers from the input string. For some reason.