How to Write Bad Software
Developers who simply lack skill or experience often produce bad code which can become a maintenance nightmare. What’s less often understood is that average or even skilled developers can also easily end up writing bad code if they’re not careful, and there are several key reasons why.
Many developers have worked on systems that are full of awful code, making maintenance difficult-to-impossible. When this happens, it’s easy to take one look at the system in question and think “Wow that’s bad. If I could re-write this system, it would be 10x better!” I’ve thought this myself many times, but in reality I find that actually writing good, maintainable software systems is much more difficult than it is to write off someone else’s code as awful. This is because of the simple fact that even occasional mistakes can lead to an entire system becoming unmaintable. It is the nature of bad code to become exponential in scope and effect, which is why it is so easy for a good code base to become an awful code base in far shorter time than you would think.
A few of these key mistakes are easier to make than others.
Developing Too Quickly
Moving too quickly is almost always a mistake, because it means that code is being put into production that hasn’t been fully thought out and likely has not been designed as well as it could have. Particularly in the case of quick patches, you are building up technical debt and making your code base harder to maintain. What should happen is that the technical debt should be payed down as soon as possible; what usually happens is that it gets ignored. This leads to other even-worse-code being built on top of the already-bad-code, and can result in complete disaster.
Not Enough Attention to the Details
This is often a direct result of moving too quickly, but can just as easily happen because of simple carelessness. Subtle bugs result, and patching with more bad code ensues. The solution here is similar to the previous mistake — slow down and think! Writing thoughts out with good old-fashioned paper and pen forces you to slow down and consider all the angles, and makes for good visuals too.
The key take-away here is that it is possible to write good code 80% of the time and still end up with an unmaintainable system! Writing high quality software systems is hard, but slowing down and paying attention to details at all times will help you get there. On the other hand, writing unmaintainable code DOES ensure you get to keep your job 😉