obfuscated: To make so confused or opaque as to be difficult to perceive or understand

The art of obfuscation in programming is very interesting, and is often done to protect vital intellectual capital. In Google’s case, as I wrote about previously, the nature of web pages demands that part of their Google Suggest code is available to the end user. It’s not compiled, so you get the raw source code. So rather than make it easy to read, Google obfuscates it. This is also often done in the Java world, where you can easily decompile code into something that’s vaguely human readable.

The process is quite simple. Take some code that the average programmer can read, and make it into something that’s still valid code, but almost impossible to decipher. For example, the following code snippet is quite readable:

int counter;
ArrayList array = new ArrayList();
for(counter = 0; counter < array.size(); counter++) { array.get(counter); }

but the same code obfuscated might look like:

int e4;ArrayList v=new ArrayList();for(e4=0;e4<v.size();e4++) {v.get(e4);}

That doesn't look that hard... but imagine a few hundred lines (or thousands) written like that. You'd quickly give up on frustration.

There's actually contests to see who can write the most obfuscated code, in both C and Perl.

Comments are closed.