To Roll Or Not To Roll, That Is The Question
So let’s say my LAMP web application needs some set of functionality. There’s a class or set of classes out there that provide…usually about 80% of the functionality that I need. Of course, because most PHP code libraries don’t have a .NET-slick API, I usually end up parsing the code down to the base class to get my arms around the thing.
About halfway through this venture, I inevitably find myself thinking: “Screw this, I’ll just hand-roll this puppy myself.”
Nine times out of ten, that’s what I end up doing. I rationalize this using the following reasoning:
- I’ll know the code because I wrote it, so if I need to tweak the library it’ll be quick.
- Most webbish APIs suck. Especially open-source APIs. I’m good at writing webbish APIs.
- By the time I get this library wired up so it works how I want, I could have written the thing myself.
- Rolling my own makes me a better programmer because it forces me to deal with a challenge that I might otherwise sidestep by using a 3rd party library.
- I’m smarter than everybody else, so NATURALLY whatever I write is doing to be better (note mild sarcasm).
Problem is, lately I question this reasoning. My brain generates the following counterpoints:
- Yeah, you’ll know the code, but that means you have to take the time to develop, debug, and test it.
- You just think they suck because you can’t get them figured out inside of five seconds. Not so smart now, are ya?
- You’re fooling yourself, it’s going to take you longer to write it and it’s going to be so narrowly focused you won’t use it again.
- Yeah, or it makes you a worse programmer because you’re not exposing yourself to other people’s styles of coding, which may be more ’standardish compliant’ than yours.
- Keep telling yourself that. Is that why you keep round-filing your old libraries because you look at them and think they’re crap and need to be rewritten?
Yeah yeah, I tell myself, but here’s the ultimate issue: I’m a web application developer. I’m not writing non-managed Win32 apps in C++. Web apps just really aren’t all that complex. My resistance to Other People’s Code isn’t the same as my saying, “The Win32 API sucks, I’m going to make my own.” Ugh. That would be an exercise in self-flagellation.
Of course, there is the argument that I’m reinventing the wheel. Yeah, well, what if the current wheel sucks? I’ll make a better one.
And so it goes.