snow's blog

Software is Art

I've practiced both traditional and digital art since I was in middle school. In art class, we studied the 'history of art' - a topic that my peers were not fond of. They are not to blame, it felt included in the syllabus just for the sake of it. But for me, who was a history junkie back in the day, this was another Wikipedia run.

cave painting | 500

Rather, let's talk about what I found. When I practiced the creative arts, I felt the same urge to create as I did when I made my first calculator in C. I discovered that this urge to create was not limited to traditional art forms or programming languages. It was a fundamental aspect of who I am as an individual, a manifestation of my innate desire to express myself and make a mark on the world.

I thought about it - and slowly my canvas expanded from a sheet of paper to my computer, and then to the entire universe. The history of art is the history of our species, each a contribution to the grand tapestry of human experience, a win against the sandstorms of entropy.

Keys are Brushes

We take up our fists, then the chisel, the sword, the drums, the brush, the pen, the pinhole camera, and now our electronic friends - all in an effort to place some marker in time about how 'we were here'. Art is a an act of deliberation, and the instrument is in the grander scheme, irrelevant. The creation of art was more about the exertion of one's will on the universe - it is proof that we are alive, and of our survival. We are the vanguards of creative expression, and capturing the human essence through our work is our duty. We are the custodians of our own ideas, the title of artist is one that is not to be secluded to an esoteric sect trained to use the brush or to sing, but to everyone who has, is, or ever will be alive.

drawing

Beautiful Code

Programming, as an art form, is no exception to aesthetics. A clear aspect would be the visual appeal of well-designed code. A good programmer can make a statement through their code, just as an artist might use color and composition to convey emotion or mood. The way that variables are declared, functions are defined, and data structures are implemented contribute to that. Code readability is in my opinion, a big subset of programming aesthetics. There is a reason why whitespaces exist, and many programming languages use a common nesting format : it is pleasing to look at.

The addition and subtraction of abstractions is like pottery, where putting and taking away clay is key to a functional masterpiece. Each program and its source code conveys the intent of its creator like a story.

Elegant Machines

Programming is just another medium of software that moves people. Software engineering is the parent art form. In another perspective, painting can be thought of as engineering, we use the constraints of our canvas and materials to convey something meaningful. These constraints do not stifle creativity; instead, they channel it.

The elegance of software can lie in the extent of its complexity and efficiency. The Unix philosophy, for example, advocates for software to do one thing well. This simplicity is an art form; it requires distilling complex requirements into straightforward implementations that are easy to understand and use. In some sense, it is similar to why mathematicians feel math is beautiful, and strive for elegant solutions to complex problems.

Simpler programs which are very efficient, often groundbreaking-ly efficient, are beautiful. My favourite example of this is a classic : 0x5f375a86, or the fast inverse square root algorithm. In the 1990s, real-time 3D graphics were rapidly advancing, with games becoming increasingly complex in terms of rendering, physics, and interaction. Traditional methods were too slow for the high-performance demands of real-time 3D graphics. What John Carmack's team at id Software needed was a way to approximate the inverse square root that was both fast and accurate enough for practical use.

float Q_rsqrt(float number) {
    long i;
    float x2, y;
    const float threehalfs = 1.5F;

    x2 = number * 0.5F;
    y  = number;
    i  = * ( long * ) &y;                         // evil floating point bit level hacking
    i  = 0x5f375a86 - ( i >> 1 );                 // what the fuck?
    y  = * ( float * ) &i;
    y  = y * ( threehalfs - ( x2 * y * y ) );     // 1st iteration

    return y;
}

The magic of 0x5f375a86 lies in its bit-level manipulation (we can see in the comments why those who reviewed this code were probably also aware of this magic). The algorithm starts by treating the floating-point number as an integer, exploiting the IEEE 754 representation of floating-point numbers. This bitwise trickery provides a rough initial guess for the inverse square root. The impact of this algorithm on Quake III Arena was profound, the game could render complex 3D environments more efficiently, delivering higher frame rates. Although hardware advancements that contain the rsqrt instructions made this obsolete soon after, 0x5f375a86 cemented itself as art in history.

QUAKEIII

There is also elegance in intricacy. Complex software running all around us is a testament to human collaboration, cogs in the background that seamlessly integrate with our day. The OS kernel in your phone to rocket guidance systems to full self driving, these pieces are everywhere hidden by simple abstractions.

Art Should Be Celebrated

Unsung software cries everywhere ; like a watch on a hand that does not know its value. We sit on a throne of abstracted software that makes our lives what they are today. From the seamless navigation systems guiding us through unknown cities to the algorithms that secure our communications, our daily experiences are intertwined with the silent symphony of code. Yet, the artistry embedded in this software often goes unrecognized, overshadowed by the visible interface or the tangible device.

xkcd captures this in Comic #664 really well:

Comic#664

Title: "Some engineer out there has solved P=NP and it's locked up in an electric eggbeater calibration routine. For every 0x5f375a86 we learn about, there are thousands we never see."

By recognizing hidden artistry, we honor our humanity and of those who pour their passion into code that shapes our lives.

A Recursion of Artists

A tool of art is irrelevant, but still necessary. Maybe the tools themselves are art, in some sense. The same can be said for the computers of today. But in this boundless expanse of silicon and light, where the only limit is imagination, these machines transcend mere tools.

They may have the potential become artists in their own right, capable of art that both imitates and innovates upon human expression. But they are not there yet - machines lack human intuition - but then art not need be made by human hands. It can easily be the lack of that, something that pleases our primal pattern recognition. To create art is to be alive. Whether or not the artificial is yet capable of that is a question for another blog.


If you're here, thanks for reading. It was really fun thinking and writing about this.

If you liked what I write, stay tuned because I am pushing out some more blogs in the very near future!

Follow me on X