Is coding creative?

November 5, 2024

30in30

I once asked on Twitter whether coding is a creative or analytical activity. Is writing code an art, a science, or a mix of both? While some people leaned fully toward the analytical side, most agreed it's a blend of both - creativity and logic.

In my opinion, coding is largely creative. The more I can code, the more computer science patterns I learn about, and the more strongly I feel about it.

I am a knitter and when I think of coding, I often think of knitting.

In knitting, the most intricate lace shawl is made of a few simple stitches, arranged in a specific order, to create a visually pleasing pattern and a functional piece of clothing at the end.

Similarly, in coding, even the most complex applications are made of basic elements - strings, arrays, and functions, basically sequences of letters and symbols - crafted together to form something remarkable. Yes, you have to follow certain principles or you will see a whole lot of errors, but, within those guiding principles, you are free to be creative.

Try different things. See what works and what doesn't. Solve a problem differently. Think outside of the box. Take inspiration from different languages and frameworks, and how they solve a specific challenge, but put your own twist on it. Follow conventions where appropriate, but keep your eyes open. Have fun with code in a way knitter might have fun with yarn.

Knitting is just one analogy. One that I feel close to. However, perhaps a better one is poetry.

Ada Lovelace, a pioneer of programming, saw the beauty in both poetry and mathematics. She had an intuitive perception of hidden things. Walter Isaacson says in his book The Innovators that she called maths a lovely language, "one that describes the harmonies of the universe and can be poetic at times." Her father was the great English poet Lord Byron and Ada was always very close to poetry. She understood the connection between poetry and analysis in ways that went beyond her father's talents. In one of her letters to Charles Babbage, Ada said:

I do not believe that my father was (or ever could have been) such a Poet as I shall be an Analyst; for with me the two go together indissolubly.

Ada's vision reminds us that, just like mathematics, coding can be a kind of poetry, a language of harmony and creativity.

So, embrace your creativity in code, let it surprise you, and remember that, like a poem or a shawl, the value lies in both - the process and the result.