Monday, June 18, 2007

The Sky Hook

A hook shot, in basketball, is a play in which the offensive player, usually turned perpendicular to the basket, gently throws the ball with a sweeping motion of his arm in an upward arc with a follow-through which ends over his head. Unlike the jump shot, it is shot with only one hand; the other arm is often used to create space between the shooter and the defensive player. Once the ball is in shooting position, the hook shot is one of the most difficult shots to effectively defend. - Wikipedia, "Hook Shot"

It's been called "the most beautiful thing in sports", by Bill Russell. Basketball's version of the pirouette, the player spinning on one toe with arms in the Bolshoi Fourth Position - there is perhaps nothing closer to ballet in any contact sport. Nothing so graceful, nothing with so delicate a form belying the hidden strength required to pull it off, nothing so sweet. The sky hook -- or at least the version of it perfected by Kareem Abdul Jabbar -- is truly the most lovely thing to behold in all of basketball.

But the thing about the sky hook that fascinated me so much when it recently popped up again into my consciousness (thanks to Michael Sokolove), the thing that made me believe that practicing it and actually trying to execute the shot in pickup games (which noone does anymore) might actually have some deep and important lessons to teach me, was the realization of how perfect a union of form and function it is. Its form actually derives almost entirely from its function -- the spin to create space between oneself and the defender; the arm held out at the horizontal to ward off the defender and maintain that space; the ball released at the apex of the motion of fully extending the other arm in the vertical at the farthest possible angle from the defender -- all of its style is also all of its substance. There is nothing in it that does not contribute to the main objective: to put the ball in the basket. It is pure economy of motion, so much so that it almost seems effortless, at times.

Perhaps this perfectly efficient utilization of energy had something to do with Kareem's incredible longevity. Other than Robert Parish, no other player has played in more games, but Parish was nowhere near as prolific as Kareem. Indeed, Kareem is the NBA's all-time leading scorer, with the eighth highest field goal percentage in the league's history.

When Kareem Abdul-Jabbar left the game in 1989 at age 42, no NBA player had ever scored more points, blocked more shots, won more Most Valuable Player Awards, played in more All-Star Games or logged more seasons. His list of personal and team accomplishments is perhaps the most awesome in league history: Rookie of the Year, member of six NBA championship teams, six-time NBA MVP, two-time NBA Finals MVP, 19-time All-Star, two-time scoring champion, and a member of the NBA 35th and 50th Anniversary All-Time Teams. He also owned eight playoff records and seven All-Star records. No player achieved as much individual and team success as did Abdul-Jabbar. - bio

The sky hook was not only the most beautiful, the most poetic offensive maneuver in basketball, it was also the most consistently devastating weapon, the most eternally difficult to defend against, perhaps the most reliable single shot the game has ever seen. It pleased equally the aesthete and the businessman in us. Which is what, I realized, I've been trying to do for my entire career as a programmer. It's what us programmers are reaching for when attempting to craft solutions that possess that elusive quality of "elegance".

We use different terms as conceptual tools to try and get a handle on exactly what it is we're doing as programmers. Computer Scientist. Engineer. Hacker. The appropriately vague "Developer". None of them quite right. Each addressing some aspect of what we do -- "scientist" emphasizing the analytical aspect, "hacker" emphasizing the more aesthetic aspects -- but ignoring others (except for the neutral, and popular, "developer"). Even as we hack away in eXtreme fashion abandoning the hope that the process of creating software can ever be predictable, and embracing the creative humanity of programming, we acknowledge the brilliance of Knuth and his algorithms, are forever engaged in the quest to optimize tradeoffs between time and space, continue to try to create software that is generic and reusable (implicitly searching for universal and general "laws of software", I think, when we do this), and can never forget that, ultimately, what we are doing as programmers is creating virtual machines.

All software must function, must have some utility. All software does some thing for its user. But, any savvy programmer knows that there are all sorts of non-functional issues, within a technological landscape that is under constant flux, that must be confronted and resolved in the development of any software system. And, I think, the very best among us are able to incorporate aesthetic concerns into the process. The mysterious thing about this is that oftentimes the software that address the functional and various other non-functional concerns in the most optimal fashion -- that, in effect, has the most business value -- is also the most beautiful. Just like Kareem's sky hook.

After a certain high level of technical skill is achieved, science and art tend to coalesce in aesthetics, plasticity and form. The greatest scientists are always artists as well. - Albert Einstein

So often style and substance, or form and function, are considered orthogonally. While I do believe that beauty is an inherent good, to be appreciated for its own sake, and believe the same about utility and efficiency, I don't believe that treating them separately is the best approach to building software. Striving to create computer systems that are at once maximally beautiful and maximally useful, not ones that make trade-offs between the two, or that try to balance the two, but that, like Kareem's sky hook, possess a form which derives perfectly from function even while being beautiful, seems to yield the best result.

Perhaps, it's because there is no way to take the human element out of software. Even software that doesn't directly interact with lots of users at runtime must be maintained by humans, consists of code which must be read by humans, possesses a design and an organization that must be apprehended by humans. Man and machine is another false dichotomy. And ugly software is hard to digest not only by end users, causing its popularity to suffer, but by the programmers who must maintain and evolve the software, causing its maintenance to suffer (and any software project manager worth his salt is intimately aware that the lion's share of the cost of any software system - 70 to 80 percent - goes towards maintenance). There is nothing more easily absorbed by a humanoid, more efficiently absorbed if you will, than those things which please the soul.

To succeed in doing this, even on the smallest of scales, is I think the greatest source of wonder and of pleasure that one can get in programming. To create something that not only creates measurable utility in the world but also creates immeasurable beauty, without sacrificing either for the sake of the other, well there is something almost miraculous about that. Which is why I feel so fortunate to be able to do this thing called computer programming.

And why I'm off tomorrow to the basketball courts to practice my sky hook. I don't really know exactly how this perfect union of form and function is achieved, in any sort of predictably repeatable fashion. But I have this feeling that there is some ineffable lesson in how to do it that I might absorb by practicing my hook shot.

B-ball anyone?