Coding As An Art

Amrita SawhneyAmrita Sawhney
4 min read

In his book, "Feel-good Productivity," Ali Abdaal explains how the best way to get work done is by making work fun and joyful. For me—and maybe for you too—working on code doesn’t always feel that way. The good news is we can learn to view coding, not as a series of issues to debug or hit our heads against again and again and again, but instead as a way to create and shape worlds. Learning to view our work from this perspective can open up previously unfathomable spaces of fun and curiosity. Coding becomes something more freeing, a form of expression - art.


How are Coding and Art-Making Acts of World-Building?

Seeing code as art may seem strange at first. We’re used to thinking of art as something more tactile, something aesthetic that you can see and admire on a canvas, a stage, or even a screen. But coding, like art, is a form of world-building.

At its core, coding is an act of creation. It’s like painting or writing a story, where each line you create builds into something larger, a little world that operates within the rules you set up. A movie, for instance, pulls you into a different version of reality, capturing a director's vision. A painting is a window into the artist’s inner world. In the same vein, code is a bridge between thought and experience, offering an entirely new version of reality.

Sure, code may not seem as visually captivating as a painting at first glance. It’s full of syntax, loops, and variables instead of brushstrokes. But it’s that code that shapes the YouTube pages we enjoy, that lets us scroll through Instagram or binge-watch Netflix. Even if we don’t understand the code itself, we experience the world it creates. It’s similar to enjoying music in a language we don’t know. If you learn a bit of code—or the language of that song—it enriches the experience, unlocking a new level of appreciation.


Artistic Liberties to Take as a Coder - An Example:

So, how is coding in and of itself artistic? Let’s look at an example: creating a simple task three different ways. Imagine you’re tasked with reversing a string in JavaScript. Here are three ways you might do it:

  1. Method 1: Using Built-in Functions

     javascriptCopy codefunction reverseString(str) {
         return str.split('').reverse().join('');
     }
    

    This approach demonstrates a coder’s knowledge of built-in JavaScript methods. This is straightforward, clean, and efficient, following a clear, linear logic. This method highlights a developer’s ability to recognize and leverage existing language features, producing a solution that’s both concise and performant. Using built-ins shows that the developer values clean code and knows when to apply tools that enhance readability and maintainability, which is essential in team-based environments where multiple people need to understand and work on the same code.

  2. Method 2: Using a Loop

     javascriptCopy codefunction reverseString(str) {
         let reversed = '';
         for (let i = str.length - 1; i >= 0; i--) {
             reversed += str[i];
         }
         return reversed;
     }
    

    Here, we’re using a loop to build the string in reverse. This version is a bit more manual, but it’s also more explicit about the process. This solution shows that the developer understands the fundamental mechanics of string manipulation and looping in JavaScript. It’s an approach that can be particularly appealing when looking for someone who is hands-on with algorithmic problem-solving, as it conveys flexibility and a willingness to engage with the nitty-gritty details of a task. It also suggests that the developer could adapt well to lower-level languages or situations where built-in methods may not be available.

  3. Method 3: Recursion

     javascriptCopy codefunction reverseString(str) {
         if (str === '') return '';
         return reverseString(str.substr(1)) + str[0];
     }
    

    This recursive approach builds the reversed string by repeatedly calling the function itself, which showcases an understanding of recursion—a valuable skill in any developer. This approach demonstrates the coder’s ability to think about problems differently, crafting solutions that go beyond standard iteration. It also indicates that the developer possesses versatility and an openness to using more abstract techniques, which can be advantageous when working on unique or intricate tasks. Yes, this approach is a little complex. It doesn’t take the most direct path, but...

each approach works! Each opens up a different skill and perspective on how to accomplish the task. In the same way a painter might experiment with colors and styles to evoke different feelings, each coding approach gives us a new lens through which we can shape our work.


TLDR;

"In limits, there is freedom. Creativity thrives within structure." - Julia Cameron

Coding, in its essence, is a craft that balances logic with creativity, structure with freedom. It lets us build worlds from scratch, worlds that others do not simply view and appreciate. Coding lets us build worlds that people can actually step into, experience, and engage with.

So next time you sit down to code, think of it as a canvas, and of yourself as the artist with limitless possibilities for self-expression. When you start to love the process, it’s amazing how much easier it becomes to love the result. There is no right or wrong. It’s about what you as a unique individual can create, and the possibilities are truly endless.

0
Subscribe to my newsletter

Read articles from Amrita Sawhney directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Amrita Sawhney
Amrita Sawhney