Intro

A few years back I had an idea. I was talking to a colleague and explained that I was pretty sure that the person who developed the software I was given to maintain (yes, about 98% written by the same person), did not only have their first attempt in web application development but must have also gotten half a shelf full of books titled "Best practices of [topic]", read them and said to themselves: "Nope! I'm doing it differently, I know better!".
Just as I showed my colleague the comment line "Es kann sein, das [sic] ich mir hierbei etwas gedacht habe." - which is German for "Maybe, I might have thought of something while doing this..." and was kind of symbolic for the whole code base and data model - it came to me that it is of course easy to point out bad code or architecture but that is often just a matter of taste or overwhelming complexity - I mean, no developer actually likes getting somebody else's work handed over for maintaining it the same way it was done all the time. At least that's what I've seen within about every project I looked into.
So I thought there should be a book or a blog showing those objectively really bad examples, stripped of surrounding code to make it clearer and then analyze and explain why and how it can be improved. So here - a few years later - it is. But to make it not too one-sided, I will mix in other topics, random rants, nerdiness, etc. etc. Bear with me...

Before you start reading: The views expressed in this blog are my own and not the ones of current or past employers. Code and project examples on display were found in various real projects over many years but have been rewritten to focus on the actual problem and hide the origin, developers and other sensitive information. Especially when I'm talking about security issues, they have either been fixed a long time ago or the software is not in production anymore for also quite a while.

Additionally, since the gathering of this gallery of "Stilblüten" - German for "howlers"? - took quite a while, there might be stuff from the PHP 4.x era, which should and will be re-examined because the language has come quite a way and has gotten a few improvements.

Thanks for reading and looking forward to seeing you in the comments!

Holger Segnitz, 2017-07-15