You are reading a MIX Online Opinion. In which we speak our minds. Karsten Januszewski Meet Karsten Arrow

Opinions

6Comment

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.

Here’s another observation, one more grounded in engineering than philosophy, which has to do with inheriting managed code as opposed to  JavaScript. One of the projects had both C# and JavaScript, a few thousand lines of each. Guess which part was easier to grok? The C# by far. Why? Features of Visual Studio (and the awesome Resharper plug-in) like Find Usages, Go To Definition, and View Call Hierarchy made navigating the code a breeze across multiple files.  I could easily jump around between methods, see all instances of a member variable and overall follow the code.

Wading through the JavaScript was a nightmare. Trying to understand things like dependencies between scripts, where variables were initialized, and scope of objects was quite painful. Maybe there’s a tooling solution to this problem, but the present state of the world makes the life of a developer inheriting managed code much friendlier than that of a complex JavaScript project.  Yes, this is a generalization, but one which I believe holds true because of the fundamental nature of the languages themselves.

So, are you down with O.P.C.?

Follow the Conversation

6 comments so far. You should leave one, too.

Jemaleddin said on Aug 3, 2011

The moral of the story appears to be that you ought to get a better IDE for Javascript development. :-)

Tim Aidlin said on Sep 22, 2011

You do great work, Karsten, and it was great to work with you over the years as the designer on the projects that we've put out.

ghjfvhy said on Dec 5, 2011

hjhgjghjghj

steel pipe said on Apr 20, 2012

of the story appears to be that you ought to get a better IDE for Javascript

Miu Miu Wallet said on May 31, 2012

This article may possibly be mentioned on Twitter by someone. genuinely?

Ken said on Jun 4, 2012

Hello,
I write a political blog and recently we went through an election. Your Archivist is the cleanest software that I've come across yet that I can use to write the blogs from what people have said on twitter. The one problem I have is that I'm not sure whether your program can be used for mining old tweets( 2 -3 months old). Is it possible are there setting that I can use to search back that far.
Thanks, Ken