4.27.2012

I mostly write throw away code

I'm pretty sure Github (any other social code sharing site is also guilty) has changed my coding habits forever. What was once a mostly private activity followed by some sharing is now extremely public. Why do I choose to push code there which I've spent few hours working on. Well, it's hard to resist the energy. You follow all your friends and see all the projects they've been working on and who's committing to what. Regardless of how good anything that is being committed might be, you want to share too. Not committing for even a few days feels like you're falling behind in a race. I don't even know when this race finishes; maybe it's just an endless sprint to be something. Surely my willingness to produce and share the amount of code that I feel is necessary to keep up is taking a tole on my quality of work; how could it not?

Most of my code lacks documentation. I'm not even talking about formal docs; it's lacking those too. No, it usually lacks even the slightest organized overview of what it does and why anyone would really want to use it. A few months later, I might not even remember why I wanted to use it and chances are I don't anymore. This code should never have been released. On the insanely small chance someone else stumbles onto it, they have a near zero clue of what it's for.

I usually wing the API design. Heck, flying by the seat of your pants never hurt anyone right? This berserk idea that I can get an API design right just by thinking it up on the spot is so wrong. If anyone were to tell me they just thought up a new API and coded it up immediately, I'd know they got it wrong. Why don't I bother setting the same standards for the code I share? I'm stuck maintaining bad API's if anyone else uses it and I'm stuck using the bad API if I use it. Its sadistic and dumb. I have absolutely not taken the time to design a modular, transparent, discoverable library. This is not something that can be done overnight, but I sure act like it can.

Tests. Pfft.

So, why do I share throw away code? Well, sometimes an idea or two in it is worth sharing. Most of the code is short enough that it can be read in a few minutes. I guess I am really sharing so others can read it, not use it. At the end of the day, I love the ideas that I produce more than the code that represents them. Ideas are representable so many ways, but code speaks the clearest to me; other programmers might agree. At the end of the day, most of what I'm sharing is bad code representing interesting ideas and if you take an honest look of what's hosted on Github, you would see everyone else is doing that too. There is only so much time for doing things the right way. There is a lot of time for sketching ideas and experimentation. Being good is knowing the difference and when it matters.