Hacker News new | ask | show | jobs
by bballer 2409 days ago
Maybe your case was more complicated but most IDE's now will tell you about unused variables, methods/functions etc. So if variables storing the calculations that were being built up never ended up being used in the end context of the function you may have gotten a nice gray/red line. It becomes harder to trace if those values are being updated into some table which then never gets used.

It is amusing that sometimes huge swaths of complicated code exist simply because everyone inheriting them is to scared to touch them even though they are basically orphaned and have a net 0 effect on outcome.

1 comments

This was code written in PHP 3 and part of pricing and tax calculations on an import with data coming in from a custom made inventory management system module for an ERP solution running on Windows outputting the most god awful XML in UCS-2 with node names that contained accented characters, and converted that data into temporary MySQL tables for the custom made web shop.

Fun fact: the import, to take into account the fact that product IDs could change (as the entire product database with over 50k products was rebuilt with every import), would also update the IDs of all items in customers' shopping carts at the time of the import. Great fun if the customers had a product in their cart that was discontinued or changed.

That single function was 56 kilobytes of code.