I really need to stop oversharing.

It’s great to be open about a former addiction, and about being in recovery. But I have this bad habit of oversharing, specifically about things that I achieved while I was still on meth, at work. With zero irony, I’m going to overshare them again here, but also explain why those achievements don’t mean anything.

Where I work now, apart from the many code patterns that I came up with in the old days, there are three main portions of my old code that are being used. (Where applicable, I’ll refer to “meth code” or “meth version” to differentiate between code then and now.)

  1. There’s an application, running on a server for nearly three years now, that watches a process, and automatically restarts that process if the process crashes, and also sends out emails with the log of that process. This is merely a simplified version of an almost identical application that I wrote to control the ffmpeg console application to do video conversions. It’s simplified from the meth version, can control any process given by a parameter, but otherwise is the meth code verbatim.
  2. There’s a class used to generically and easily do SQL select queries, which is fast and lightweight. The only changes from the meth version is that the original was a static class that took in a connection string parameter on every method, while the current version takes that at initialization, and has a different name. Further, in the last two months I’ve started adding asynchronous versions of the methods to the class. They aren’t new, but existed in the meth version in 2012 already – I’d removed them to make the class simpler.
  3. There’s a library, for use by myself or other programmers, to read flat files from a source (I won’t explain because this is proprietary information) where each line contains a number of fixed width fields. It’s reusable in such a way as to make it easy to implement the reading and writing of such files for different institutions, by using inherited methods.

The last one is especially complicated and works very well, and I recently blurted out to a junior developer who is using that library at the moment that I wrote it on meth. I wish I didn’t do that, and I’ll explain why…

Here’s the thing… I’m a programmer, a coder. It’s what I do. It would be surprising if there wasn’t old code that I wrote that’s still running. The fact that I wrote it on meth is irrelevant.

Any code of mine still running anywhere, or still being used by developers, will of course be good code. This unfortunately gives the false impression that meth didn’t affect me as a developer and that I didn’t write bad code. It did and I did. You just won’t find that code anywhere because it’s bad. Also, this gives the impression that I’m saying something like, “Look at  me. I’m so clever. I wrote this great code when I was on meth and you should be intimidated because I’m so much better than you.” What an arsehole, huh? Meanwhile what I’m really saying is, “Look at this! It works. It fucking works and I’m amazed that it does.” And every time I come across some old meth code, I open my mouth about it before thinking about what I’m saying, before thinking that maybe I’m giving the incorrect impression that meth wasn’t so bad. I need to stop doing that.

So, here are some examples of the terrible meth code I wrote that you won’t see anywhere:

  1. (This happened in 2009 right before I first went to rehab.) Incomplete code that would compile but never work. I remember realizing, on my last day at that job, what I had done… I’d created a complex interface, then implemented it in the code that needed to use it, and referred to that implementation in the places where that was required. (It was part of a large program and that’s how the framework worked.) Except, I’d only written placeholder code for the interface implementation. Code that didn’t actually do anything other than make sure the code compiled. And then checked it in to source control, which meant it went out in a build of that application.
  2. In 2007, ASP.NET AJAX code that somehow left a web page reloading itself using tons of data from the server, infinitely. Fortunately I found this before it caused a problem, but still… This was terrible code.
  3. An ASP.net application that used up so much memory, the app pool would be recycled by the CLR (Common Language Runtime). Only to immediately do it again and again and again. And then some more.
  4. A Windows desktop program that would randomly have a thread deadlock, one that every other thread in the application was waiting for. The application then stopped responding and would have to be terminated from the task manager. It could run for days or weeks without any issue, then just get stuck and sit there, dead.
  5. Runaway threads. In 2011 I wrote a program that used parallel processing to do some work, but I did nothing to throttle the number of parallel threads being created. It was recursive as well, and would spin up thousands of threads to the point where it would do nothing other than switch from one thread to another to another, none of which did anything other than yield to the next thread, which yielded to the next thread, and so on.
  6. Runaway threads again. Having mastered parallel processing (after the previous fuckup), I moved on to the Task Based Asynchronous pattern, but made a similar mistake… No throttle for the number of threads (Tasks – but it’s the same sort of thing) being added. This time I managed to use up all threads in the thread pool.
  7. Runaway window handles. I don’t remember how I managed to do this, or why in the fuck any program would need to create so many window handles on the fly, but trust me when I say that the Windows operating system has a limited number of window handles, where a handle is just a number that represents an identifier of control like a textbox or something similar… And I managed to use them all up, bringing the entire operating system to a grinding halt.

So that’s it. I overshare at the worst time, making it sound like I’m boasting about the good things I achieved on meth. I’m not. Sure, there’s a lot of good “meth code” of mine still being used, but that’s only because it’s good code. The bad code has long since been rewritten or deleted.

Leave a comment