3 ms·
I worked for a company that makes sortation devices (conveyors etc), and i inherited an old product from a previous colleague. The software was largely a stand
by 8fingerlouie 8y ago
I worked for a company that makes sortation devices (conveyors etc), and i inherited an old product from a previous colleague.
The software was largely a standard base with modifications done for the individual customer to suit their business needs.
In this particular project, it was a batch sortation, meaning we received a large batch file from their mainframe, which would then be parsed and executed by the controller software.
Everybody feared this particular project, and estimates on new functionality were sky high, but I didn't think much of it until i had to modify the batch parsing code. I was met with 22000 lines of C code in a single function. This single function was modified multiple times each year, usually adding more code in the process.
It took me the better part of a month to refactor into "manageable" chunk sizes, and in the end i was left with a 1700 LOC function that was still "too big", but nobody really understood how it worked, and we couldn't test it, so i just left it at that.
After my refactor could implement new functionality somewhat faster, but in the end it was still a very complex algorithm, so despite being in smaller functions, you still had to be very careful when modifying it.