I've only recently taken up obfuscation, having cobbled together a JAPH in the past few days. In general, I consider myself at least a competent programmer when it comes to straightforward code. My comments are comprehensible and I have legible style, I eschew global variables, &c, &c. But with Java as my first "real" language (and the one I work in most at the moment), I know little of the full power and feature-set of Perl.
Writing this first JAPH actually taught me a lot, though not directly in the writing. Naturally, as a first attempt, my mind wandered to ASCII codes, and I was forced to learn of ord and chr. In order to obscure things further, I played a bit with eval. Whee.
Most of the things I learned didn't end up in the JAPH itself. Instead, I learned them through studying (and, once or twice, understanding) a number of other nodes from the obfuscation section. They're not exciting; most are just built-in functions whose syntax I was finally forced to learn and got to see a few (very) creative uses of. A few, off the top of my head: splice, split, system, command-line switches such as W, n, T and e, reverse, and fork.
This was like a fun exercise in school which secretly (don't let the kids know!) teaches some core skills. I'm sure the next time I sit down to write an actual, useful script, I'll remember some of these functions and use them. It will save me time, and it will probably make the code shorter and more legible. Obfuscation has made me clearer and more efficient? Bizarre...
Learning from Obfuscation suggests rightfully that obfuscation lives in the "evil dark corners of the Perl." But a major component to successful education is that people be interested, engaged and having fun with what they're learning. Our XP system is one simple way we amuse and encourage ourselves to keep working hard at hacking, teaching and learning. Obfuscation is another. It's a learning tool, a self-challenge, a mental exercise. It provides puzzles to create, take apart, reassemble, solve. It strengthens the mind like working out strengthens the body.
But surely: writing regular code does all these things too. So how is the mental process of writing code that belongs buried in deep dark corners different than writing ordinary code? What does obfu do for you? What has it taught you, and how has it made you a better hacker?
Edit: Corrected the node number of my japh.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
An obfuscated parable (was Re: What obfuscation can teach)
by roboticus (Chancellor) on Nov 04, 2007 at 12:17 UTC | |
by joel.neely (Novice) on Nov 05, 2007 at 13:04 UTC | |
by LassiLantar (Monk) on Nov 06, 2007 at 00:05 UTC | |
|
Re: What obfuscation can teach
by dragonchild (Archbishop) on Nov 04, 2007 at 19:59 UTC | |
|
Re: What obfuscation can teach
by vrk (Chaplain) on Nov 04, 2007 at 17:19 UTC | |
|
Re: What obfuscation can teach
by technojosh (Priest) on Nov 05, 2007 at 22:28 UTC |