Blog.

To write, to program

The programming

The cursor was blinking at me in the empty editor. "Back to Hometown" was the program I was working on. The character should be able to enter their current life status. At one point, they'll be notified they must return to their hometown. Another user that they're connected with has invited them. So, they review their life status. They need to make a decision. But it's not an easy, logical pros and cons kind of decision. They're required in their hometown. If they decline this invitation, they'll lose the connection. That's why they accept the invitation. They can arrange all the necessary lists and messages for their journey. What will happen to their contacts in their current location? What about their obligations and commitments? They'll be able to communicate their journey with all of them.

This was the premise I started with. What user journeys must I consider in a "back to hometown" program? Screen after screen, the users should be able to express themselves and interact with each other. Prior to that, how was I going to clarify my users as characters in my program? On top of that, there will be conflicts between them and with my program. I should consider these points of friction.

Why was I writing this program? To make it clear, first, I need to look back.

The beginning

I closed my work laptop and opened my own. Another working day has been passed. Today, like most days, I coded for a few hours on a usual business requirement. My mind has been itching for a creation that will leave my users in awe. But my day job couldn't satisfy this urge.

Conversely, the tables turn when I sit in front of my laptop. I often write what I believe is meaningful: Code or prose. I took notice of prose when I was a teenager. I grew up in a remote, small city where massive bookshops with endless shelves were nowhere to be found. The only showcased books were hidden behind racks of notebooks, pens, pencils, and textbooks. And if you happened to discover these hidden gems, you'd also find yourself disappointed if you were older than, say, fourteen.

Going to libraries wasn't a go-to option for many. Chances are, the library collection wasn't remarkable to begin with. I never knew you could access thousands of fascinating books by simply being a library member or a mere visitor. I didn't grow up seeing people do this. We didn't have school libraries either. If a modest shelf was dedicated to books, it was mostly for textbooks and religious sources. Except for some ancient adventure stories, if you were lucky.

The love

Nevertheless, longer, profound books found their way into my life. I was rereading those funny little fairytales my parents gave me over and over until I was old and bored enough to crave more. I started reading novels. The magical feeling of finishing my first novel has stayed with me; that transportation to a new, unknown, foreign world while still sitting in my tiny room shared with my younger sister. Hence, I fell in love. I found solace in writing poems and journaling my feelings as a socially struggling kid.

What were the odds of falling in love with literature in this setting? I heard the chimes of destiny. It felt like I ought to devote my life to this passion. I must study the literature and take it from there.

The reality

You see, I'm a Middle Eastern woman. In my parents' eyes, my destiny was to be a doctor, the highest achievement and most glamorous and respected one in my small conservative community. I shall follow the steps of my father and add my name to the family board of honor. This journey didn't speak to me at all. I negotiated it down to engineering. My safer, yet still parent-reliever passion.

Years have passed after that decision. I studied engineering and became an employed engineer in a new country where you have enough time and energy to follow your passions. These days, reading has become my hobby. My escapism, like many others. Writing, on the other hand, is more of a fantasy. I spend 40 hours a week in my financially stable job, and I live in such a thriving, safe environment that, once again, I crave more.

A wishful dreamer that I am, I found the genie in the bottle and uttered with yearning and dread: I Want to be a writer, a creator.

"But you're already a writer and a creator. Just a different one using a different language for different people." Genie replied.

"Am I?"

"Why, Of course, who's a writer but a creator of bugs presented as features?"

"Wasn't this a programmer joke?"

I dismiss this notion. This can't be true. Engineering and literature strike as galaxies apart—enough with daydreaming. I continue working on the coding project I opened my laptop for.

The writing

I had this idea for a documenting tool connecting every doc you create to another—no more lost orphan docs in your team. Every piece of data you worked so hard to gather and document will be easy to search and find since the whole shebang will be interconnected. I had a vision for it, an outline of what I'll present. The bare minimum to work, I started with that. A landing page: It was going to be my first scene. I set the tone with headers, buttons, links, and images. You, my user, are going to expect to see these.

I added another scene. So you'll be able to interact with it. This scene was the login—your first connection point to my app. Next, I needed a personal space for the docs and added an editor. You get to know the app. But you're not hooked yet. Therefore, I went on and added the whimsical elements. You're going to link docs together. You'll see a convoluted graph of them, notice which information is repeated in another doc, and you'll be able to ask questions from your docs using fancy AI tools. I had been closer than ever to catching your attention. Yet, I must finish the flow and fill the gaps with the required plot points in my user's journey. More scenes, essential features, a profile, a dashboard, tweaking the interface, and connecting all these together.

I repeated this cycle until my application had the complete user journey. Now, it had a story to tell. So far, this was only the surface, the black box I'll present.

I had a world to build. My users were my characters in this world. I was ready to serve them some features, but what are they like? How do they behave in my app? These were the questions I needed to answer. I then abstracted the answers into small blocks of types, defining all the characteristics I required to consider in my app's world. I used types to safeguard my writing to ensure I wouldn't neglect the needs and deeds of my characters.

I looked at my code. It was messy and unreadable. This wasn't a kind of code that was future-proof. I wouldn’t be able to quickly fix bugs or add features to it in the future. I'd be embarrassed to share this draft with an enthusiast. It was unreadable, with plenty of questionable decisions. So, I rewrote the code, moved stuff around, and ungrouped and regrouped blocks.

I made the code easier to understand with lucid logic this time. I had a working code, but it wasn't enough. The functionality must be efficient. I'll need to delete whole chunks of work, as there's a better way to write it.

After all these revisions, I ended up with a code that was a joy to work with and read. Improvement opportunities were endless. Nonetheless, with this round of rewrites, I was confident to share the product and the code with someone else.

Programs must be written for people to read and only incidentally for machines to execute.

― Harold Abelson

Here and now, I'm done. I pressed the keys until it became a creation I built and others will consume.

Perhaps I was convinced that to program is to write. But even if it was, how was it going to help me? I wanted to be a writer, not a programmer who feels like a writer. Unless... Unless writing is also like programming?! I may not need to learn a new craft from scratch. There's a chance I already know some skills.

The realization

It doesn't make sense. It sounds foolish to think they're similar. You write beautifully crafted prose to steer emotions in human beings, and you call it literature. Then, you write carefully built code to serve users efficiently and reliably and call it a program. How can writing be compared to the rigid way of creating a black box to output some functionalities?

At the end of the day, you write and solve problems for people to read. Maybe a writer and a programmer are two sides of a coin. Am I trying to convince myself what I do has a whole other meaning? Am I bending the reality to feel good about myself? The meticulous nitpicker inside me thinks so. They're against all this wanna-be-writer nonsense. What's in there that engineering can't fulfill?

But precisely when I don't expect it, I come across an external validation for this hypothesis of mine. THE "Brandon Sanderson" suddenly starts talking about how writing and programming are similar in an interview. Does he also know how to program on top of everything else? This leads me to suspect more than ever that he may be a supernatural being who has descended upon Earth to rule us all one day.

If you are a writer, if you really like writing, programming and writing feel very similar. In fact, I had to stop taking a programming class in college because that semester was the hardest I ever had writing. Because I would do my homework, and then I'd feel like I'd already written for the day when I'd been coding. It would leave me mentally exhausted. Most of my other classes used a different part of my brain. Coding is basically writing. It's the same sort of thing. When you're writing a novel, you're problem-solving how to achieve the results you want to get.

― Brandon Sanderson

He continues to discuss how there are things that drive us, such as creativity. The point is to find what is fulfilling for us and project it into different careers, making use of it. It is uplifting to hear this perspective from such an accomplished writer. That was when I decided to present a theory: “To write is to program.” I will put it to the test with the story idea I had in my mind for a while: “Back to Hometown.”

The ending

My first rambling draft of the "Back to Hometown" has started to portray a peculiar kind of outline. With the programmer's mindset, I noted anything worth exploring. The sentences are incomplete, the spelling is wrong here and there, and the words are simplistic and repetitive at times, just like my first version of coded tokens called a program.

So, I started the refactoring and made it readable. My second draft looked better. The structure turned out cohesive and, dare I say, interesting. However, it sounded so mechanical. I ought to add a more personal perspective and less definite statements. I rewrote and edited it. And I repeated it until it became a creation. But the conflicts and plot points had a long way to go. The writing read like a description rather than a story. This was the storytelling quest I'm yet to conquer.

The magic doors of fiction storytelling may not have opened up to me just yet. Still, I could tell a story like an engineer would start a side project. I came up and solved a bunch of problems my characters might have experienced. Alongside the journey, I tried to make it readable and understandable. Did I program a story? From my perspective, to write is to program.

All these learnings and experiments filled me with tranquility. Perhaps, at some point, I'll decide I won't be a published professional author. However, I am a creator and storyteller in my chosen career path. And this is what truly drives me. I use words to create and connect, although it is in a different language for different people.

Will I forget the dream? Not for the time being. I'll write more. I'll write more programs and more stories. I'll find the middle ground. I'll combine these two skills. I've started with this story.