Down With O.P.C.Jul 22, 2011 In Development By Karsten Januszewski
For the past few years, I have had the luxury of working on projects which I own the development entirely, from end to end. My work on Mix Online (Oomph, Glimmer, Archivist Web, Archivist Desktop, Flotzam, and Incarnate) has been architected and written by me, in collaboration with a designer but with no other developers.
Recently, however, I’ve been involved in two projects (to be announced soon) where I had to work with Other People’s Code (O.P.C.). In both cases, the codebases were significant, but not insane, at about 5000 lines of code each. For one, a developer got about fifty percent of the code written and then bailed. For the other, a developer completed version 1 and I picked up where he left off, implementing version 2.
Both experiences with O.P.C. have been painful and rewarding, leaving me with some reflections. First, the pain.
My friend once commented that the real reason encapsulation was invented was to protect developers from other developers. Ah, the beauty of the black box. But when you inherit someone else’s code, you’ve got to take that black box apart. And you’re pretty much guaranteed that it isn’t going to be pretty. Inheriting code means having to understand the machinations behind the machine. Inevitably, this is time consuming and hard.
And of course, there’s goofiness in the code. Most code is written under a deadline, baked to a point where “hey it works—ship it.” I was fortunate enough that both projects were written by rock solid developers, but even then, I found weirdness: conditional blocks that did nothing, remmed out code that may or may not be critical to the project, and half-refactored methods that were more confusing than if there were duplicated code. Not to fault them—I’m sure my code would be riddled with similar oddities if put in their shoes.
I got to the point several times where I thought, “Why am I even struggling with this? It would be faster to just write it all myself again.” It’s a microcosm of the “build vs. buy” dilemma that CIOs face everyday.
But I stuck with it, knowing I’d end up having to solve the same problems they’d already solved. Why not discover how they solved the problems? And therein lies the joy.
Working with another developer’s code can be a phenomenological experience, in the sense that you become empathic with the other developer, an intersubjectivity as Edmund Husserl would say. There’s something incredibly affirming and weirdly intimate about that experience. “Ah ha! That’s why they did that. . . Very clever!” You get the rewarding feeling of solving the problem as they solve the problem and the communal thrill of appreciating another’s brain. You feel less alone.
So, are you down with O.P.C.?