This Hack Was Not Properly Planned
Nikolai Krylenko: We must finish once and for all with the neutrality of chess. We must condemn once and for all the formula ‘chess for the sake of chess’, like the formula ‘art for art’s sake’. We must organize shockbrigades of chess-players, and begin immediate realization of a Five-Year Plan for chess.
I can also recommend this harrowing list of chess problemists who died or were imprisoned during this era in Russian history. It’s as if the lines between actual war and the game were blurred: chess became too real and imprisonment became too strategic.
And you can see where it all came from. Here Krylenko was living in Switzerland splitting his time between chess games with Lenin and plotting with the Bolsheviks to overthrow the czar. I’m not suggesting that chess fed his combativeness (though, in a steampunk world, Columbine would have been pachinko’s fault,) no no hardly, it seems quite the opposite is true, that Krylenko’s warmongering spilled over on to the checkerboard. We must finish once and for all the neutrality of chess!
But, you know, I think it’d be a much, uhh, greater stretch for a programmer to twist hacking into a battleground. Yeah, sure, there’s War Games, but writing code isn’t a simulacrum for war like chess is. Subverting the authority is totally inherent to hacking. Rather than attacking a fixed opponent, one who is clearly sitting across from you and obviously masked under the inverted color to yours, the novice hacker introduces volatile code into the pristine (or supposedly pristine) empire of the operating system (the “establishment”.)
Try to tap into any of the initial fear you felt while programming. Will this work? Is this dangerous? And the computer rejecting your advances with error after error.
Perhaps this is why I have trouble swallowing unit testing or extreme programming or other best practices as the law. I guess there’s a place for these tricks (the work place,) but they do not speak to the pure form of hacking for hacking’s sake, which I so ardently defend! Unit testing, in particular, is designed to reel in spontaneous hacking. It is like framing a picture before it has been painted. Hacking, at heart, will continue to be something of spontaneous order, something of anarchy, and the landscape of hacking is something which comes from human action but is not of human design.
Here, I’ll give you an example. Right now the term Programmer implies employment. There is the rare Con Kolivas, who worked as a doctor while he did Linux kernel stuff, but we’re already calling him a Doctor now, aren’t we? Yet, the very marketplace that has vacuumed up all the Programmers has prevented to stop those Programmers from devaluing the monetary value of software and shrinking certain markets in their spare time. Free software burst at the seams. With seemingly spontaneous combustion. Did the Doctors do this to their industry?
You could blame Stallman, but I just don’t think that gives entropy enough credit.
I really think chaos is an essential component of writing code. The system is too big for you to fathom. So you are always finding yourself in unfamiliar territory. And once you fathom the system, it becomes too boring and tedious to pay attention to details.
But you do not really fathom the system! Not all of it. You’re just ignoring the chaos. Think of the variety of platforms and the complexity of each of them, each with millions of unseen bugs and undocumented avenues. And the constant need to relearn strategies which have become outdated or which you learned incorrectly in the first place. Think of how much code you already pinch from other programmers, of which you only really understand the soldering points.
Oh, and I don’t really pretend to really know what I’m talking about, I just know that I will randomly say the right thing. When defending chaos… anything goes! (At any rate, my audience is so small, it doesn’t matter, does it?)
Which brings me to batsman’s 5-line wiki, which some of this small audience might recognize:
#!/usr/bin/ruby -rcgi
H,B=%w'HomePage w7.cgi?n=%s';c=CGI.new'html4';n,d=c['n']!=''?c['n']:H,c['d'];t=`xx
cat #{n}`;d!=''&&`echo #{t=CGI.escapeHTML(d)} >#{n}`;c.instance_eval{out{h1{n}+
a(B%H){H}+pre{t.gsub(/([A-Z]\w+){2}/){a(B%$&){$&}}}+form("get"){textarea('d'){t
}+hidden('n',n)+submit}}}
Whenever obfuscated code was posted on RedHanded, you could guarantee a reaction like that of dustin in the comments: “5 lines? With Error checking?” Otherwise known as: Humpfh, good sirs, this code is not maintainable! And which also rears its head as: This is exactly what I hate about Ruby! This code makes me want to shoot myself! Host rejects graft! Brain rejects brain poisons! The Serious Skeleton Has Emerged From His Crypt Of Contemplation And He Has No Funny Bones For You!
Come on now, kids, enough with the invasion of the serious, this code is a classic relic of Mauricio Fernandez. This code goes right in my museum. And don’t put it behind glass, because I want you to go right up and see it unfiltered. It’s an audacious and plundering and wonderfully disastrous bit of code. All in five lines. And it works! It’s actually a real wiki!
This hack communicates so many things. I mean it’s five lines, but the first line is a she-bang. Yet he counts it because it uses Ruby’s dash-r switch to require the cgi
library. That line itself mocks how arbitrary the 5 is. Clearly this code is littered with UNIX-isms, between the she-bang and the various backticks. He’s literally filling this thing with taboos to put you off, as if obfuscation wasn’t alienating enough.
I mean the line where he’s using echo
to stuff the escaped HTML into a file doesn’t really save many characters, it’s just there to pull your chain.
And why exactly wouldn’t programmers want their chains pulled? Surely programmers must have the longest and sturdiest and clankiest chains in the biz. They said so on the mailing list. Is getting your chain pulled CONSIDERED HARMFUL? Ohhhhh no!
But here I quote from Edsger Dijkstra, the father of CONSIDERED HARMFUL, who once said:
Two opinions about programming date from those days. I mention them now, I shall return to them later. The one opinion was that a really competent programmer should be puzzle-minded and very fond of clever tricks; the other opinon was that programming was nothing more than optimizing the efficiency of the computational process, in one direction or the other.
Two opinions, eh? One must be correct! And I, Edsger Dijkstra, will decide! We must finish with the neutrality of programming once and for all! We must organize shockbrigades of programmers, and begin immediate realization of a Five-Year Plan for programming!
From the same essay, his popular saying:
The competent programmer is fully aware of the limited size of his own skull. He therefore approaches his task with full humility, and avoids clever tricks like the plague.
So it’s all hogwash. The very thing which draws you to programming is your undoing. Unless you are it’s undoing. I hate you, Edsger Dijkstra!
Lastly, I’ll just quote myself, in the tail recursive form, something I said on December 24th, here, in this very story, at the end of a truly terrible tale:
Far too many chess players have died for us to stop hacking for hack’s sake.
Now begin the comments …
adam
I’m not so sure. Solving problems and puzzles is more often about boiling it all down than being an autistic kid in Mercury Rising starring Bruce Willis.
floyd
Adam, are you sure programming (hacking?) is a puzzle and not, say, a piece of art? Or something else? Consider the blog you’re commenting on--if you are sure, I’m not sure why you’re reading it.
why, have you read a hacker manifesto? It seems a tad somber for you, but Eric Mill gifted me a copy recently and I found it to be a sort of glasses and chalkboard for your children in the streets. If you have read it, a penny for your thoughts.
In any case, hear hear.
silby
Hacking for hack’s sake means not being satisfied with the tools you’re given and the rules you’re given. Hacking for hack’s sake means that if you want do perform a task from the command line or Quicksilver or a bookmarklet or a microcontroller installed inside a teddy bear entrusted to a small child, the only thing stopping you is your own creativity. Hacking for hack’s sake means making your electronic ecosystem entirely your own. Hacking for hack’s sake means five-line wikis, thirty-line wikis, wikis in your text editor, wikis on your iPhone, wikis snuck into the office during the dead of night. Hacking for hack’s sake means Vim bindings for Firefox. Hacking for hack’s sake means never doing anything by hand more than twice before you write a script to do it for you. Hacking for hack’s sake means the only unit test you run says
assert hacker.satisfied?
and it never, ever passes.LninYo
COLORING
Sarah Hall Maney
Coloring
outside the lines
is scary business
Some days
I don’t have the courage for it
at all
On my big, bold days, though
I let my red crayon
just streak across a line
Then I swirl my purple and orange
out there with it
in perfect freedom
no lines
Coloring outside the lines
is lonely, too
I’m the only one
who doesn’t get
a gold star on my paper
The teacher frowns
the kids call me weird
or dumb
or retarded
Why don’t they see
that I’m not behind them…
I’m out in front
running free
outside the lines
It would be nice
to have a friend
who colored outside the lines,
sometimes,
too…
Would you?
From Chuck Moore’s ColorForth Page
rubyMan
but… while those one-liners or 5-liners (whatever the size) can be useful, and demonstrate that ruby is powerful just as well..
i really would NOT want to maintain such a piece ever. I mean… i write in ruby.
Not perl.
the daniel
hear hear, hack the good hack, etc, rah rah ☃ ☃–sometimes i catch myself feeling a tiny bit of shame telling new artsy acquaintances that I am a programmer–because I know what I mean when I say it, but they never do…
alan
I’d rather drown in a heaping pile of dioxin than be smothered in its beautiful (1,4) shape; a symmetric panorama of O’s, C’s, and H’s. This time of year the teratogens are especially tastey. I sleep with a hack under my pillow, chambered … and without a safety.
IdeaHamster
You know what really annoys me? Tangled phone cords. I bet “programmers” talk and talk on the phone about what to unit test next, all the while twisting and twirling the cord of the phone, and then when it’s lunch time they just plop down the handset. Just like that. Tangled cord.
…but at least their code has unit tests, right?
The worst bit is that I can go on for hours about why unit tests are good and yes, you should use unit tests too. But when I sit down to code, I never use them. In a way, I guess I’m like a unit test used car salesman.
meek
‘tsallgood, dear _why. Hackers know what I’ve said about having good rules many times. You follow the rules at first, when you don’t understand them.. and then, when you understand them, you don’t care about them anymore. And why should you? You don’t need them, you know what to do.
Note, though, that breaking the rules without understanding them usually isn’t very useful.
fauxparse
When I was fifteen, I was in an international programming competition in Bangkok. One of the questions involved writing a QBASIC program to solve an arbitrary, screen-size maze under time constraints. Our first idea, a simple recursive search, was too slow, and anyway, the stack was too small to handle pathological cases. My team-mate eventually hit upon the idea of modelling an army of tiny robots: on each iteration of the algorithm, the robots would self-reproduce into any empty adjacent cells, and then die, leaving behind a cold, dead husk (ASCII code 35 decimal).
We did OK in the competition, but what we loved most was Shaun’s awesome new algorithm for solving mazes. We were on cloud nine until we got back to the hotel room and described it to our tutor, who promptly categorised it (correctly, of course) as breadth-first search.
We were momentarily crestfallen, until we realised that Shaun had, unaided, invented and implemented breadth-first search in about twenty minutes, under competition pressure.
I guess what I’m getting at is that if you can make up little stories about infinite armies of problem-solving robots to help you code, maybe you won’t end up with Dijkstra’s Algorithm™, but maybe your code will be easy to understand—and fun to write.
James
Drifting Into Test-Driven Development is a refutation of your claim that unit testing is boring: “It just makes sense to think about my interface first, and to spend a minute pondering what sort of devious corner cases I can throw at it. I’m writing more tests, letting fewer bugs into production, and having more fun.”
LninYo
This is a Call to Arms! BITCHES!
Sunny
There you have it ! “Production”, that dreadful place where all the real work is and the fun is left behind…
Anthony
I’m with meek.
More particularly: I don’t think TDD is necessarily at odds with hacking.
Deciding to test-drive development is just choosing a way to explore codespace, much like picking a particular language. No-one would claim you can hack in language A but not language B, right? I see hacking as being another level up, it’s more about how and why you enjoy the exploration.
More particularly still: I, personally, have plenty of fun test-driving whilst hacking.
LucasOman
Refusing to be stifled by best practices is one thing, and it’s not a new thing; to touch on the gagging cliches, everyone who’s ever caused a shift in perception or the field of possibilities--Beethoven, Lennon, Newton, DaVinci--questioned the “best practices” of their field in their day. But you mentioned yourself that we can’t possibly understand every avenue, every corner, of the systems we work with. Isn’t that why we have best practices? To invent the wheel without understanding friction coefficients is foolish. Even though you disagree with their choice, maybe your predecessors decided a sleigh made more sense because you didn’t realize that you live in North Dakota.
Chaos is for after-hours. Chaos is a bunch of possibilities and fewer probabilities, with only one or two sure things. Once you’ve polished all that and have one sure thing in your hands, use it at your day job. At that point, it’s a best practice. Best practices have an origin. Chaos has a conclusion; to claim to subscribe to one and reject the other is short-sighted. To accept both as part of the process shows your passion and dedication to your field.
bug
My, I’m glad there aren’t too many of us to make this sort of unanimous groupthink. Yes, yes and yes. Also: when hacking, make sure that the chaos you start out with is really chaos, not something that you saw “that guy” doing. It needs to be your chaos.
brrm
Thank you _why
for making me think
:=)
eli
Despite reading the post a few times, and visiting the links, and reading the comments—I still don’t know what we’re discussing here.
When I think of The System, of Bureaucracy, of The Establishment, well, this is when people who are Up There get together and make things complex and hard to approach for The Little Guy. It’s not that things Up There really are complex, it’s just the feeling The Little Guy is meant to have, so he doesn’t Get Involved.
How does one bridge the gap between prose meant to invoke free-though, and the realm of inaccessibility? Does it defeat the purpose if someone explains to me what the heck is going on here?
With great respect,
-Eli
Alisey
Why, so true! I do my best things when I just relax and play programming.
It would take a week on my day job, and I couldn’t do that anyway.
Sweet chaos.
bug
Wow, Eli, I dunno. I don’t think there’s really a shared secret, though, so I’ll try to clue you in: nothing more is here than, as you said, prose meant to invoke free thought, and you’re correct in suspecting that no clever word alone can actually kick-start it, since that wouldn’t really be free thought.
I could go on if you’d like, but I don’t know if it would “defeat the purpose”. Just go and hack, maybe, and see what you come up with. You shouldn’t obsess over it.
Cryptic clue and question for _why: Isn’t pre-eventualism being able to see the bridge?
philip
Here’s my idea of two extremes which both challenge the establishment, but differently:
puzzle-oriented programming: do something really tricky with the tools you have to make the program work.
meaning-oriented programming: write the program how you think it should be written and so it reads nice. Then write the tools to implement the language you just wrote it in.
Matt Todd
Invigorating. _why as always you tickle my creative fancy and my willingness to step and dance and jump and kick outside of the box.
I do think, though, that, to some hackers, writing tests can be just as wild and chaotic as just writing things that work; really, to some degree, perhaps j of Arkansas doesn’t quite know what needs to happen but at least wants to make it look like it is going to happen which can kick start his creative motor and let him drive right off of the ramp of normalcy. I am like that, sometimes, I’ll write a client library before the server exists so I know how to make them talk like old pals, and I guess you could do the same with unit tests… talk like old pals with your invisible friend, them breath life into those vacant lungs.
Gambistics
Thx why. Yes, hacking doesn’t need tests at all, but who of us isn’t searching for some order in this chaos sometimes? Making a test succeed can be quite satisfactory.
Apropos order: I had a really disappointing experience trying to become an ‘adult programmer’, thinking the GoF’s Pattern™ book would guide me to new insights… After all it was just so useless. Why should you read about factories when you had manufactured very special, perhaps even beautiful code yourself, why care about Builders when you feel you created structures of bits and bytes most of your life, nothing new in there…
In the end it taught something, though: Books contain only things which are already there. Creating something new is up to you.
_why
silby’s post is the perfect sequel. Thanks, kid!
And alan. Down came alan with the noxious plumes.
Pre-eventualism can’t see the bridge, but there are definitely bridges and we anticipated them, bug! Though, I should add, we’re restraining from anticipating them any further. Maybe because Dijkstra said our skulls are too small for it.
Evan
But Why, he says that there are two prevailing perspectives from the day and then he chooses one. Not that I’m necessarily agreeing with him but I’m merely pointing out that he did not specify that he subscribes to both of his chosen pigeon holes—just that he recognizes two and evidently subscribes to one.
Ed Borasky
I once had an autographed copy of Dijkstra’s The Discipline of Programming, and yes, I was there when he autographed it. He was one of my heroes, right up there with John von Neumann, John McCarthy, Kenneth Iverson and Chuck Moore.
I never have understood what it was about chess and programming, go and programming, puzzles and programming, etc. I’m a pretty good programmer—for many years I was the best that I knew. But I suck at chess and won’t even consider playing go. Hell, I’m not even any good at gin rummy or hearts or bridge.
I’ve never read The Hacker’s Manifesto or The Cathedral and the Bazaar. Then again, I’ve never read Pride and Prejudice, War and Peace, or Zen and the Art of Motorcycle Maintenance. But I have read Design Patterns in Ruby.
Well … off to follow your links to OLPC and Chuck Moore’s Color Forth pages to see where they take me. I’m a fan of both—actually have one of the XO laptops a few feet away, though I’m not typing this on it.
One final note: KVM switches suck!
monkeymind
failrate
Not all serious computer scientists are against hackery:
``I think that it’s extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customers got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don’t think we are. I think we’re responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun. Above all, I hope we don’t become missionaries. Don’t feel as if you’re Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don’t feel as if the key to successful computing is only in your hands. What’s in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more.’’
Alan J. Perlis (April 1, 1922-February 7, 1990)
http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-3.html
:D
Sean
I’m a bit late to this discussion, but I consider some of my most brilliant ‘hack’ code to be contained in my test cases.
Unit testing is the one place the average developer is allowed to implement absurdly complex theoretical ‘brilliant’ things… because it’s just a test case so it doesn’t really matter if it’s 100% readable by an absolute idiot (and as an aside, reasonably cleaver test code tend to test more for a lot less).
Sean
Seth Thomas Rasmussen
:)
bug
OK, hacking is the process of distilling chaos, and “best practices” are the result. Thus test-first etc. are extensions of hacking, so further hacking arises from them. So never forget to hack, including hacking the best practices themselves, blah blah blah hack hack blah. Did I miss anything? Basically: “don’t ignore chaos”?
Comments are closed for this entry.