Column

# Frogging Code

Illustrated by Fauzy Lukman

In the knitting community, "frogging" means pulling yarn back out to unravel rows of stitches when you spot a problem and need to redo a section. It's a lovely word, and programming should adopt it. Yesterday I frogged multiple functions when my prototype hit a snag and I had to change the design. I had the functions working, but they did the wrong thing, so they had to go.

My favorite quote from Ken Thompson, the creator of Unix, is "One of my most productive days was throwing away 1000 lines of code." Linus Torvalds says a patch that "removes more lines than it adds...is always nice to see." Deleting existing, working code often counts as progress: you've learned by doing and come up with a better way.

Corporate management treats code as an investment, attaching a dollar value to each line and horrified when you get rid of any. The fallacy here is called "managing what you measure": if you don't understand what your employees do very well, but know how much they earn and how much they weigh, you might decide one employee is a good bargain at $80 per pound and another earning$100 per pound should either take a pay cut or gain weight.

Joel Spolsky made a good case against frogging code in his article "Things You Should Never Do Part I," highlighting the value of implicit knowledge in the existing codebase from all the real-world use cases it's adapted to handle, a testing load that can't easily be replicated in the lab, influencing a design that's never fully documented. This is the same sort of good advice for conventional proprietary software development as Brooks' Law, part of which says larger teams are less efficient because productivity increases linearly but communication costs increase exponentially.

But open-source development solves both problems by treating code submissions the way print magazines treat their "slush pile" of unsolicited contributions. Editors read through and reject 99% of them, bouncing a few entries back for revision ("I can't use this, but if you tried changing it this way I'd give it a second look..."), stitch the best few together into something vaguely coherent, and publish the next issue. This drastically improves scalability by replacing coordination with a discard/retry loop, and relies on Linus' Law ("given enough eyeballs, all bugs are shallow") to incorporate end-user feedback into the project's design loop. It's not just bug reporting; in a good open-source project, what the software should do and how it should do it is driven by the needs of the user base, often via the patches they submit to drive the project in a given direction.

Frogging code, and lots of it, is fundamental to open source. When Netscape released its source code to the world to create Mozilla, its unwillingness to delete code led to the resignation of the project's maintainer. On its way to becoming successful, Mozilla forked off the Galleon project (throwing away 90% of the code) and then forked off Firefox (throwing away 90% more). A proprietary project becoming an open-source project had a lot of moulting to do.

So don't worry about "creating negative value" when you delete code. Cry "Ribbit," and let slip the frogs of war.

##### Rob Landley

author

15 years ago Rob set out to replace all the gnu packages in Linux From Scratch with alternatives like BusyBox, and spent so much time upgrading BusyBox he was appointed maintainer of that project. Ten years ago he left busybox and started over with toybox, and last year toybox was merged into the Android M base operating system. He's currently working to turn Android into a development environment capable of building itself under itself. Along the way he got involved in j-core.org (a BSD-licensed open source clean room clone of the SuperH processor architecture made possible by expiring patents), spent a couple years maintaining the kernel's Documentation directory and kernel.org/doc. Video of him throwing liquid nitrogen into a swimming pool (at a combination linux expo and science fiction convention he'd co-foundeded) has been viewed on Youtube 11 million times.

##### Fauzy Lukman

illustrator

Fauzy Lukman is a multidisciplinary designer based in Indonesia who work on graphic, branding, illustration and also UI for Web & Mobile app. Check his portfolio on Behance and dribbble.