Working on crappy code can be a bitch. I once worked on software for which the author didn't know he could use multiple source files in a C project and he didn't like to put stuff in functions either. The end result was a single file with a few functions, even switch/case statements spanning thousands of lines. I printed everything (still on a matrix printer) and annotated everything by hand to identify the stuff I had to change. At some places there where chunks of code which I could replace with 3 lines of code which did exactly the same. Oh horror
Thank is pretty bad. But what I am dealing with is much much worse. Seriously so.
Examples:
(a)
tHisisa_FuntTHAT_IMADE_pm(unsigned char a, unsigned char p).
(b) A function called
do_nothing(), which contains a timer loop and a watchdog timer reset routine.
(c)
rrunDAIG(), where DAIG is meant to be Diagnostics.
(d) Putting a watchdog reset in a 1ms timer interrupt. Tossers!
(e) About 200 files all up - 100% of which had names which meant nothing or were ambiguous.
(f) Functions put into random files.
(g) Extreme abbreviations like
get_prdc_get_tm_sm() where the acronyms have no logical meaning.
(h) 5000 lines reduced to about 700 lines yesterday. Cut 'n paste kiddies.
(i) Up to 6 levels of Gets and Sets all over the place. Bloody Windoze OOP programmers.
(j) #defines without any case consistency. eg a_COnstant, A_constant, acon, Acon, whatever they wanted. You cannot easily depict a constant from a variable.
No joke, this is a nightmare. 50,000 lines worth. Every line of code has had to be refactored. There is more spaghetti in that code than in a bolognese for a large Italian wedding.
The good news is the more I do the less I have to do. The other good news is if there are people let loose out of universities writing this sort of frogshit, there must be a demand for people to refactor code. I feel like charging $200 per hour to do this.... $100 for my pocket and $100 for psychological rehab.
The other good news is the weekends.