Toggle Menu

Insights / Digital Service Delivery / Top 5 Reasons Writing Bad Code Happens

February 15, 2016

Top 5 Reasons Writing Bad Code Happens

2 mins read

In my previous post, I discussed symptoms of bad code. Here I’m going to look into some of the reasons we end up writing bad code:

1. Deadlines 

You’ll hear excuses like we have a deadline to meet so we don’t have time to test or make the necessary design change.

2. The Broken Window Theory

Another contributing factor is the broken window theory. Here Philip Zimbardo, a Stanford psychologist, conducted a study where he parked a car in a well-to-do neighborhood for a couple of days and observed it. Well, nothing happened. He waited and waited and no one touched the car. He then broke a small window to observe if behaviors would change. Within a couple of hours, the car was totally stripped. Gone were the tires, wheels, electronics, steering wheel, seats, mats, and engine. What was left was a skeleton of a car popped up on cinder blocks.  Well, the same thing happens with code. You start out and things are clean. Once you introduce one sign of bad code, things quickly get out of hand. As developers, we’re already doing things wrong here, so it does not matter if we do it wrong here as well. Doing it the not so right way is a lot easier and faster, so why bother putting in extra effort to clean things up and do it correctly? One by one, mistakes spread and quickly spiral out of control.

3. Over Architecting 

Here, we attempt to envision all possible future scenarios and create unnecessary layers of complexity to support things that are not really requirements and might never actually become one. As developers, we think we have a crystal ball and can predict future requirements even though the client is not asking for it. Sometimes things pan out, but in most cases, things go in a different direction and we end building something that is not needed or does not quite fit the desired solution.

4. Bad Design

Sometimes the design is just bad, and instead of stopping to fix it we continue building on top of it and create an even bigger mess.

5. Poor Skills 

Of course, poor skills or lack of proper training is also a major contributor to bad code.

 In my next post, I’ll introduce the concept of technical debt and discuss good debt vs. bad debt.

The Top 5 Reasons Writing Bad Code Happens is the Second in a seven-part series on Technical Debt from Excella Software Development Lead Fadi Stephan.

Part 1: Top 4 Symptoms of Bad Code

Part 2: Top 5 Reasons Writing Bad Code Happens

Part 3: What is Technical Debt?

Part 4: Good Technical Debt vs. Bad Technical Debt

Part 5: The Vicious Cycle of Technical Debt

Part 6: The Technical Debt Management Plan

You Might Also Like

Resources

Simplifying Tech Complexities and Cultivating Tech Talent with Dustin Gaspard

Technical Program Manager, Dustin Gaspard, join host Javier Guerra, of The TechHuman Experience to discuss the transformative...

Resources

How Federal Agencies Can Deliver Better Digital Experiences Using UX and Human-Centered Design

Excella UX/UI Xpert, Thelma Van, join host John Gilroy of Federal Tech Podcast to discuss...