Article 601HA CodeSOD: onFunctionCall

CodeSOD: onFunctionCall

by
Remy Porter
from The Daily WTF on (#601HA)

Annalise has a pile of... unfortunate JavaScript. It's thousands of files with no real organization or logic behind their organization. It's got so much tech debt that it takes a full time developer just to keep it running, let alone provide support or add features or fix bugs. And the backlog of features and bugs is so long that it's best described in terms of .

Which is to say, there's a lot in there that nobody understands. So when you see a bunch of callbacks registered to onFunctionCall, you might assume that this handler is doing... something. You'd be wrong.

onFunctionCall(varA, varB){ for (let i = 0; i < varA.length; i++){ if (varA.condition){ if (varA.field[i][varB.attr] == varB.id){ let temp = varA.field[i]; } } }}

This... doesn't do anything. It has no purpose or point. And yet, it's sitting in this giant pile of code, registered as a callback in all sorts of cases, because someone felt like it must be important. It is not.

proget-icon.png [Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more. TheDailyWtf?d=yIl2AUoC8zA
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments