So there's an already deployed system.
It doesn't take more than a glimpse to notice the following:
- no versioning control, just the deployed version
- no documentation
- no comments
- commented code
- a bunch of scripts, one for each step of the algorithm
- a Perl system, shell scripts that invoke the Perl scripts in specific orders, a PHP backend
- a bunch of stuff in crond
- a bunch of files ending in ~, .bak or .old
- a directory called bk (yes, from backup)
- a couple of files with different names but with the exact same content
- an ever increasing number of processes, which sometimes have to be killed when the machine is running too slow
- a database with tables that have several columns that have never been used
- several modules, in the same namespace, with replicated code among them
- several modules with replicated code inside them (copy-paste, yes)
- way too many lines of code with more than 80 characters
- to be honest, way too many lines of code with more than 120 characters (the record is 588)
- lack of indentation
- lots of spaghetti code
- a bunch of things you'd never do in Perl
- nested if clauses where you could use a simple dispatch table (these ones make my eyes hurt)
- for and foreach mixed around (at least you should pick one and stick with it...), sometimes Perl-style, sometimes C-style (sometimes using $i, sometimes using $xy, sometimes using other variables)
- hardcoded passwords
- serious security problems (at least judging by the amount and complexity of SQL queries constructed without using placeholders)
- a testing directory with nothing resembling tests; just a couple of scripts which you run and then you look at the output to see if it's what you were expecting, assuming you know what the output is supposed to look like, of course
- and then a directory called "legacy", into which I don't even dare look
And that's just a glimpse.
Normally, I wouldn't write a post about something like this... But seriously, can you see the amount of problems with this thing? And it's only from 2005! And from a guy who keeps writing on his blog about how clever he is!
Now tell me: What would you do?
I'll tell you what the people in charge decided to do... Rebuild the whole thing from scratch. Forget it even exists, and start all over again, this time with someone that (hopefully) knows what he's doing (that would be me).
And now, a personal note...
It's always easier to complain and to criticize other's code than doing it yourself.
I would totally understand that one day, the person who built that system would come across this post or something else I'd written about his project, and would come back at me, in a defense of his technical skills.
With that in mind, I'd like to leave a note to that person, regarding how he built this thing:
I dare you to explain what you were thinking and the decisions you took, assuming you took any!