Spaghetti code

Once upon a time, many years ago, a colleague came to me and asked me what I knew about a code-base I had never heard of. "Nothing", I replied. He told me it was urgent to get the code up and running again as it had broken down in February or March. It was July, I think.

I called upon another colleague who didn't work at the department anymore and he told me that the code was stored at an old desktop PC which had a post-it note attached: "Do not delete". He also told me that the programmers, who had left the company already, were incredible professionals and that he was impressed by the job they had done.

Long story short, we recovered the code from the PC and stored it in the cloud.

Then, I had the "privilege" to look at the code. It was not pretty.

If you know anything about Model-View-Controller, you know that it is a three tier philosophy meant to simplify code development. All security work is done by the Controller, all business logic is performed by the Model and all the output formatting is done by the View.

The programmers had ... not quite comprehended this idea. They send code from the model to the view and back again ... it was a mess. It was Spaghetti code.

After spending way too long pouring over the code-base, I found out what was going on. It was a terrible "what the fuck!?!?" moment.

Instead of using parameters to get data from the database, they constructed the SQL statement dynamically. That, in itself, is something you shouldn't do. The problem was that they added more and more clauses until the query became too long to be parsed and the program crashed.

As the code was ASP and I had never programmed in ASP, I requested an ASP programmer to do the job under my supervision. The programmer I got was seriously incompetent and should have been fired (he was fired months later). I left the company and I don't know if they ever sorted out the mess of this 'urgently needed' in-house reporting software.


Popular posts from this blog

A recipe for failure

Ubuntu - Auto-mount an encrypted drive