The mantra “everything as code” permeates today’s IT departments. Scripting is nothing new, but it’s experiencing a renaissance as the DevOps movement continues to grow.
Code enables IT pros to automate common tasks, freeing them up to perform more valuable work. At least, that’s what it’s supposed to do. But coding errors are common and a natural part of the job. (Nobody’s perfect, after all.) And bad code can wipe out those benefits, forcing script authors and their colleagues to waste time troubleshooting and rewriting.
We asked members of our customer community, The Root, to share stories about the worst code they’ve ever written. Here’s what they had to say:
“I wrote a code to convert a user’s distinguished name to their email address. It froze the shell, and hitting CTRL+C only printed out ^C over and over. The shell would not close until I forced the process closed.”
-systems administrator, internet media company
“Not one of my best decisions, but I was updating a live website without using a dev or test environment. This was old Classic ASP programming. It took two days to find my mistake.”
-network manager, construction and engineering company
“I left a hard abort in a code that silently failed. It appeared successfully, but did nothing, and was there for months before the next dev came to edit the same bit of code and found it.”
-head of operations, SaaS provider
“During my university time, I wrote a code which had 19 ifs. It did work, but when I was asked to change something, I could not.”
-operations manager, media and research firm
“I didn’t use the proper index in a for loop. Basically, it did a bunch of stuff to one server rather than one thing to a bunch of servers.”
-systems analyst, healthcare provider
What’s the worst code you’ve ever written? Let us know on Twitter.