Computer Programming As Art
This isn’t about programming the visuals for the next great Pixar release, or even creating ASCII art for signature files, but whether the craft of programming itself can be artistic.
West Coast types, like Google’s co-founders Larry Page and Sergey Brin, and many other programmers will recognize the name Donald Knuth. When it comes to The Art of Computer Programming, he not only wrote the book, he penned several of them.
If you’re curious where they stack up historically, Knuth noted on his site that The Art of Computer Programming stood in good company:
Pat yourself on the back if you’ve read them all. Maybe you are an artist, whose oeuvre is expressed with includes and logic statements.
Pragmatic Programming authors Andrew Hunt and David Thomas have considered the art in computer programming, speaking about the topic in Denmark in 2001. “We think that it is all of these things, and none of them,” they said of programming in comparison to art, craft, and engineering discipline.
They noted how the genius of Michaelangelo can help programmers with their tasks. In painting the ceiling of the Sistine Chapel, Michaelangelo did so in a way Hunt and Thomas believe indicated a careful approach, represented in three steps: high cohesion, low coupling, and conceptual integrity.
Cohesion gets compared to Unix command-line utilities – they do one thing and do that one thing well. Each panel of the Sistine Chapel tells a story, without extraneous elements. Code should do the same.
Coupling happens when some elements extend into others. As the authors explain, if a panel of the Sistine Chapel, or a section of your code, needs to be replaced, doing so should not result in the dismantling of several surrounding panels. Encapsulation helps, but it isn’t a cure-all, so be careful.
C, Ruby, and Smalltalk all have conceptual integrity in common. “C++ doesn’t,” say the authors. “It tries to be too many things at once, so you get an awkward marriage of concepts that don’t really fit together well.”
This means constructing a project as a collection of applications that interact can help maintain the integrity of the concept behind the code. This is more than dressed-up words; think about projects that started as one thing before spiraling into much broader projects that never address the initial reason for beginning it in the first place.
There may not be room at the Guggenheim for “Hello, World.” But there should always be a place for effective code. Some would call the approach ‘artsy’; we think ‘sensible’ is a better description.
David Utter is a staff writer for WebProNews covering technology and business.