I recently have needed to write some systems that do analysis on a stream of samples. The target stream of the analysis process was stored in a variable targetOfAnal
, because obviously, that’s more efficient to type than targetOfAnalysis
. I of course needed an analProcess
and analComplete
flag, and yes, my inner 13-year old was snickering the entire time.
James’s co-worker decided to demonstrate that immature dirty jokes should only be taken so far. James heard him cursing up a storm, and thus offered to help debug whatever the problem was. You could say this code is hitting the “dirty variable names” button a bit too hard. I present it here without modification, because honestly, there is no way to censor this code and have it convey its full meaning. Ready your alt-tab before the boss comes by:
for(int ishit = 0; ishit < shit.size(); ++ishit) {
shitareas.clear();
shitsubareas.clear();
if(messed_up_order) {
messed_up_order = false;
continue;
}
if(shit[ishit].areas != "" || shit[ishit].subareas != "") {
if(shit[ishit].areas == "" && shit[ishit].subareas != "" && ishit+1<shit.size()) {
messed_up_order = true;
}
if(shit[ishit].areas != "") {
auto shitstart = shit[ishit].areas.begin();
auto shitend = shit[ishit].areas.begin();
while(shitend != shit[ishit].areas.end()) {
shitend = search(shitstart, shit[ishit].areas.end(), delim.begin(), delim.end());
string asdf(shitstart,shitend);
shitareas.push_back(asdf);
shitstart = shitend + delim.size();
}
}
if(shit[ishit].subareas != "") {
auto shitstart = shit[ishit].subareas.begin();
auto shitend = shit[ishit].subareas.begin();
while(shitend != shit[ishit].subareas.end()) {
shitend = search(shitstart, shit[ishit].subareas.end(), delim.begin(), delim.end());
string asdf(shitstart,shitend);
shitsubareas.push_back(asdf);
shitstart = shitend + delim.size();
}
}
if(messed_up_order) {
auto shitstart = shit[ishit+1].areas.begin();
auto shitend = shit[ishit+1].areas.begin();
while(shitend != shit[ishit+1].areas.end()) {
shitend = search(shitstart, shit[ishit+1].areas.end(), delim.begin(), delim.end());
string asdf(shitstart,shitend);
shitareas.push_back(asdf);
shitstart = shitend + delim.size();
}
}
}
}
It’s a bit cheap to say this code is remarkably self-describing, but this is clearly a mishit. It’s crass as the dickens. If this developer was paid in cash, it wouldn’t surprise me. Imagine the code review- bet it would have been quite the pisser.
Honestly, it’s variable asdf
that’s the worst thing here, but maybe that’s because I type Dvorak.