Sunday, May 18, 2008

Code as an Emergent Medium

After however many years you'd like to consider computational instruction to have been around, it looks like it is now ready to be taken seriously as a medium of expression meaningful to humans as well as machines. In our plainly mathwise languages, we have always had the means to convey nearly as much as we'd like (convenience aside) but I really think that we're taking advantage of our ability to express ourselves in code beyond what's necessary to use machines as tools.

Poetry
  • high obfuscation
    It is left to the reader to find more examples, but here is one example of a recognized and heady performance in the field of perl poetry. The selection of perl is not a coincidence, but stems from perl developers' frequent concern for taste and desire for elegance.
  • more perl
    An open forum for aspiring perl code-poets. Very open.
  • lisp poetry
    Lisp is a dynamically typed language, meaning its data types are defined sort of transiently. When this page doesn't bother to decide whether it is for poetry about code or code that reads poetically, that's hilarious.
  • redbox.c
    Slightly more esoteric but of great illustrative value is this C program from 2001, heavy with nostalgia even then.

Politics
  • obfuscated voting machine code
    Premise: In a bid to point out the security risks in closed-source voting machines, entrants to this contest devise the most convincingly correct yet reliably 'rigged' code.
  • DeCSS
    Rogue programmers create code that allows people to fetch information from dvds, and wind up in civil and criminal court for copyright infringement. The code is open sourced, enthusiastically disseminated on the Internet, printed on t-shirts.
  • meta
    Said code is transcribed into English in a peculiar way. Just for effect?
  • 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
    Termed 'the illegal number', this blu-ray encryption key was the subject of a similar dispute on a large scale in 2007.


The list of so-far symbolically powerful code continues, but it's as organic as you imagine, and media crosses well - linux/init/main.c and so on.

Labels: ,

Friday, April 18, 2008

Book Review - Wicked Cool PHP

Wicked Cool PHP
William Steinmetz with Brian Ward


One of the best ways to learn a new programming language is to find existing code and modify it - not only do you begin with a working product rather than from scratch, you see standards, shortcuts, and myriad different ways of doing things. The risk run is a lack of reliability - there are few guarantees offered with most code, and there's always the possibility one will learn bad habits. PHP in particular includes plenty of pitfalls for new programmers, and there are plenty of ways for a neophyte to drop the ball with serious consequences if guidelines aren't set from the beginning.

Enter the hybrid introductory lessons/cookbook. Wicked Cool PHP, from No Starch Press, is a fantastic book if you're picking up PHP from a beginning perspective. The programming tasks outlined are fairly common ones, but are solved elegantly and proper information is given along with the examples. The book contains all that a new user needs to know about securing PHP (quite a lot) without departing from its recipe-like model of task, design, and code. The authors begin with sending email and using the session and continue through input sanitation, SOAP, and templating. Implementation-neutral database use is touched on, and the projects begin to get fairly ambitious towards the end.

Again, strongly recommended for new and enthusiastic PHP coders, who might save considerable amounts of time learning by an innovative walkthrough paradigm.

Labels: ,

Monday, March 3, 2008

Intellectual Property

IANAL (I am not a lawyer.)

I'm a proud cog in the information economy, and I make my living on manufacturing information. We all buy and sell information every day. The volume of information going around is rapidly increasing as time progresses, and I think it's clear that we don't have a good system for regulating the information economy.

On a legislative level, we currently have several failed systems for the regulation of intellectual property:

- There is no universal or global acknowledgment of intellectual property, and most systems of regulation simply break when the information leaves its creator's jurisdiction. This leads to copyright being nearly meaningless in certain countries where IP is not recognized, not enforced, or neither.
- 'Fair use' in the United States is at best a cruel joke, and protects almost no one. The segment most unable to make fair use of a product are professional content creators, whose producers are reluctant to take any risk of costly litigation.
- Users are an enormous, slow-moving target for IP owners seeking legal recourse, and cannot muster even a token defense against whatever claims are brought against them. If not for groups like the EFF, few IP suits against end users would ever go beyond settlement.
- The largest content owners and producers (along with as umbrella industry groups and PACs) take it upon themselves to sponsor politicians friendly to their interests, resulting in well-funded campaigns for any legislators willing to cooperate with them.
- The United States Patent and Trade Office is an outdated, Kafkaesque organization with no semblance of understanding and a completely broken system of patenting. This is more arguable when one is discussing non-software patents; due to a gap in understanding between those who write or patent software and those who approve and adjudicate patents, the system currently in place for patenting software is rife with abuse (even according to many owners of software patents).

On a physical level, mechanisms so far intended to prevent violation of intellectual property rights have done little more than decrease the quality of products, while increasing the cost to manufacture them.

- To date, no system of DRM-laden content has ever shown promise in avoiding being subverted, gamed, or bypassed. In the arms race between secure distribution schemes and the holders of encrypted data, the odds will always be stacked clearly in the favor of unlocking information.
- Even a theoretically secure system is still entirely susceptible to transcoding or transcription. Regardless of how difficult it is to mass-distribute a strongly encrypted, watermarked, time-expiring piece of information, if the data is viewable by a human it is likely copyable, often perfectly, to another medium.
- Streaming, proprietary, or encryption-bloated data, often infused with the mandatory viewing of warnings about redistribution, is inherently less usable and much less desirable (to varying degrees) than content distributed otherwise.

Why is it so hard to regulate our god-given rights to information? Why should we be 'punished' for sharing information with the world?

Labels:

Sunday, February 10, 2008

Book Review: Best Kept Secrets of Peer Code Review

Best Kept Secrets of Peer Code Review
Jason Cohen, et al


We cannot forever hide the truth about ourselves, from ourselves.
- John McCain
This book was a freebie from Smart Bear Software, which means that if it were presented in terms of utility per dollar, it would be nothing short of infinitely worthy. If you're interested in Software Engineering, the disciplined and systematic development and maintenance of software, I can't recommend highly enough that you go on and get your free copy. It's an insightful and provacative book, and you won't regret your investment of time.
The Best Kept Secrets of Peer Code Review remain secrets because it is manifestly evident to every coder that their code is flawless. This is pretty obvious; nobody ever sits down to add bugs to their code. A bug, logical or syntactical, is largely a matter of perception.

Black box testing for code flaws is a lot like smelling an old milk carton; a tester is here not hunting for actual flaws so much as the implication of flaws, their products, offspring, and output. Code review, as defined here, is the actual human fathoming of pre-production code. This is important, no one will deny, but is it absolutely necessary for proper development? That's the argument made in this book, and it's made with lucidity and care. The reason this book is worth reading is its careful, honest, and meticulous use of statistics to prove that enforced peer code review is a numerically better case for most software teams.

It is true, you know. The books sinews, the very guts of it, the part that will remain in the reader's mind long after all thoughts of what constitutes a code flaw, what part of design is taste and what is doctrine, and what metrics of testing are more important that others, are its brilliant and decisive forays into the metrics of bugfinding. Simply put, the better and harder you look at code - any code - the more bugs you'll find. The sooner you look, the easier they'll be to fix, and the more lines reviewed, the more bugs will be found to exist. This is absolutely, universally, inarguably true of any code that exists, and if as those axioms weren't philosophically fundamental, this book absolutely proves them and more.

The authors of the book reveal these truths so systematically that it's impossible to flinch when, on putting the book down, you will realize that the more bugs that have found per line of code in a piece of software, the less buggy the software can be said to be. An excellent read for anyone who likes to ruminate on the dynamics of group software development. It's convinced me to try out their cross-platform tool, Code Collaborator; here's looking forward to it.

Labels: , ,

Sunday, January 27, 2008

Book Review: Beautiful Code

Beautiful Code
Compiled by Andy Oram, Greg Wilson


A diamond is a chunk of coal that is made good under pressure. - Henry Kissinger

Beautiful Code is another non-animal O'Reilly volume, with high aspirations. As the sleeve submits: "How do the experts solve difficult problems in software development?" If this book had been able to answer that question, reading it would be a head-spinning experience indeed.

The book's chapters are each the domain of a different prominent software developer or writer, and several are elegant outlines of what is unarguably some of the best code out there - Apache Webserver, Quicksort, and the Python interpreter. Ostensibly, the authors are talented beyond measure; with a lack of a cohesive theme, a unified structure, or an overall purpose the book quickly becomes a showcase of beautiful code-essays submitted by thirty-couple completely dissonant geniuses. The fact that the book still contains not much other than what it claims is no invitation for criticism. If you want to see real kung fu code, this is your book.

The potential disparities hide in between the lines, where compilers do not tarry. Few of the essays touch on why the code is elegant, or how it got to be the way it was. Most of them wander around what problem is solved by the code, some delve deep into the minutiae of the problem, and a few contain no code at all. This last set could have been chosen to present a semblance of organization, could have pulled loose ends together and formed some conceptual continuity among a wide variety of articles, but in their current states and places even these well-intended 'theories of code beauty' ruminations are ineffectual.

If a computer scientist was so riveted by unpolished essays surrounding the world's best algorithmic hacks that they failed to notice that no new information was gained, no statements beyond the cold, functional truth were made, no concessions given to that imaginative side of the brain that, when it is given the occasional chance to influence the gnarled digits of a perl hacker, results in that big win - the one sought after in wake and sleep for a week - and doubles the maintainability and efficiency of some project, then that reader will be satisfied to the fullest extent.

For the rest of us, this book was no great failure but no revelation, and is deserving of its place on the shelf. And the geeks among geeks, the hackers who would have found a book closer to Hackers and Painters, held it and shook it until C code fell out, will no doubt appreciate this book.

Labels: ,

Sunday, January 20, 2008

Book Review: The Art of SQL

The Art of SQL
By Stéphane Faroult, Peter Robson

As we know, there are known knowns. There are things we know we know. We also know there are known unknowns. That is to say we know there are some things we do not know. But there are also unknown unknowns, the ones we don't know we don't know. - Donald Rumsfeld (Sun Tzu's second millennium CE incarnation.)
The Art of SQL is no Web Database Applications with PHP and MySQL. It's far beyond that; it is well past even Practical PostgreSQL and the SQL Cookbook. Not only is it written for the experienced user, it is for the ambitious user, the one who wakes up with a smile trying to retain the n-dimensional join from their dream.

The excellent style of writing used is above O'Reilly par. Not only is the text concise and well edited, the book is organized very well. In a graceful and creative turn, the presentational style of the book is allusive to Sun Tzu's Art of War; query diagrams, sample datasets, and business cases are rendered as plans of attack and battle formations in the Napoleonic era. The result is phenomenal, and structurally, this book is groundbreaking - no computer science book I've read prior has had so much attention paid to making its content engaging and enjoyable to consume - this is certainly not necessary, but it is a great indication of the overall quality of the book.

The book is SQL implementation agnostic and assumes the reader is interested in data integrity, extensibility, and scalability in the database. It assumes that you care, or want to care, whether you're following third normal form. In fact, the implied understanding here is that an earnest investment in normalization will pay dividends in optimization. Only if you're willing to perspire for it - it is an art, not a school of magic.

The SQL enthusiast will learn a lot from this book - perhaps a baffling amount. I absolutely cannot recommend it highly enough. It has been some time coming, the sort of thing that is an obvious boon when one considers that our 'art' has only been around for a few decades. We'll get it right eventually, inspired by those like Faroult and Robson.

Labels: ,

Sunday, January 6, 2008

Mathematical Symbols

Mathematics, the study of totally constructed concepts like numbers, time, logic and all that, is the closest thing we've got to a universal language. Highly intuitive symbols are included, if not universal, and let me point out a few and critique them:
  • 'Square foot', exactly like it says on the box. Not that a foot is a good unit of measurement - a human foot is of course not a standard base for a system the way the size of our watery Earth is - but this symbol is excellent in its simplicity and expressiveness anyway.
  • An 'angle'! Very nice. Just a drawing of the referenced thing. Conveniently, this one is extensible - you can mark it up to show that you mean the measure or that your angle bisects another one, or what three points describe it.
  • ƒ 'Function of', pretty daft as it's just an initialization. At least it's scripted, so you can tell it's not just an F, I guess. This is precisely the kind of thing we should stay away from. A better symbol? ☡ would at least show the process of something undergoing a path, shows a thing passing a threshold.
  • 'Infinity'. Well, I guess this one works. I've never been a huge fan of the 'lazy eight', as it in no way indicates to me an unlimited amount of anything. But as an enormously abstract concept, it's not easy to symbolize without encoding, so this arbitrary, somewhat rationalizable symbol (it keeps going!) works well enough.
  • Δ 'Delta', commonly indicating a change in something over time. Pragmatically, an arrow describing the path of the sun, phases of the moon, tides, plants, something like that would be better. However, I do think it's great that, in English, a delta is a change in a river over time. A triangle shaped change. Is this intuitive? No. But for being referential in form, it's way better than 'Function of'.
  • ¬ 'Not'. One of the absolute simplest, and best. One has taken the straight tally representing 'a thing', and broken it in just such a way that negates it in form, function, and concept. One of the most intuitive, least encoded symbols we have.
  • 'And' shows the logical joining of two concepts into a higher, compound version. + is still useful as it shows two tallies in combination, but rather than depicting them together, a∧b is clearly the union between. while it's not as intuitive as +, we at least have a demonstrative picture of a joining, more indicative of the idea that 'both of these are required'.
  • 'Or' is another logical operator, used as a∨b. The deficit of this and ∧ is that, while they're wonderful in their logical inversion of one another, they are not referential of anything, and require some prior knowledge of their meaning. Good, but not perfect.
  • 'Null', a very difficult concept to represent in mathematics: a group of nothing. I'm very pleased with this one, which is so intuitive that it's more often reddened and superimposed on another symbol to show that it is not allowed. What a fantastic and practical use! Another, even more definite success where symbols are concerned.
  • Here's another terrific one. While not immediately intuitive, 'therefore' is an abstract concept. But if abstract concepts were shaped like dots, this symbol would show two of them with a third built on top, perfect units of reasoning being built on one another. Genius.

- ∧∨

Labels: ,