Categories
Uncategorized

“It Looks Like You’re Trying to Stank Up Your Code. Would You Like Some Help?”

Gojko Adzic points to this photo taken at QCon San Francisco 2008 by John Grae. It’s a slide featuring YAGNI, the Development Assistant, the programmer’s answer to “Clippit”, a.k.a. “Clippy”:

yagni_development_assistant_qcon_slide
Photo by John Grae.
Click the photo to see its Flickr page.

YAGNI, short for “You Aren’t Gonna Need It” is a development maxim that suggests to programmers that they shouldn’t add features or functionality to applications that aren’t necessary at the moment, but might be in the future. YAGNI has the DRY (“Don’t Repeat Yourself”) Principle has a cousin and among its ancestors are Occam’s Razor and the KISS Principle (as in “Keep It Simple, Stupid” and not “I Wanna Rock and Roll All Night (and Party Every Day”).

YAGNI, the Development Assistant comes from Bunk and Rambling, a blog by Darren Smith, where he put it forth as an IDE feature request back in May 2006, when he wrote:

While pair programming helps you to write high quality code in an efficient manner there are times that a pair of programmers will end up going off on a tangent and working on something that ultimately ends up not being necessary. To counter the unbridled enthusiasm that usually causes this to occur I give you Yagni, the Development Assistant.

YAGNI is meant for developers who believe strongly in test-driven development, so here’s how it would hypothetically pop up if you tried to create a class and started entering non-test methods first:

YAGNI, the Development Assistant: "It appears that you are creating a class without a unit test. Would you like to * discard code? * create unit test?"

I’ll leave it to other people to argue over whether or not you always have to have unit tests. 

Here’s another notice from YAGNI:

YAGNI, the Development Assistant: "This development spike appears to be going too long. Would you like to * discard code? * go longer?"

And finally, what I feel is YAGNI’s most important message – a warning that you’re in danger of embarking on a long, “let’s reinvent the wheel” project:

YAGNI, the Development Assistant: "It look like you're trying to write a framework. Would you like to: * discard code? * find an open source framework instead? * find a new job?"

Since YAGNI’s not likely to appear in any IDE soon, you, your pair programming partner or whoever does code reviews with you will have to play its role for the foreseeable future.