Guest blog, Top tips

Guest Blog – Coding, Lessons from a Seamstress

AKA Sewing: Lessons from a Coder

Reading Time: 6 minutes

Sewing clothes always seemed slightly magical to me. A seamstress sits with a yard of fabric and minutes later a dress appears from nowhere. Making my first item of clothing was not so mystical. It took me three days to orient myself in the field of textiles. I researched what equipment I needed to get started, how much fabric was required and stumbled through the layers of jargon to find answers. Fabric nap, it turns out, does not pertain to how much sleep is recommended between sewing bouts.

The first time I touched a sewing machine, I succeeded in sewing all four sides of a purse shut. Can you perhaps see the problem there? A few weeks later I started a skirt. I’d sew a seam. The seam would bunch or come undone. I’d unpick the seam. Then I’d take to YouTube to find a fitting video entitled: “Buttons: For Dummies”. It took me three attempts to get the zipper right. Four attempts to iron the fusing onto the right side. At one point, I even managed to sew it inside-out. And throughout this process, my first thought was – this is just like learning to code.

For many, coding seems like a complex series of inscrutable functions and brackets, akin to the background screens in a hacker movie. Code whizzes by, magic happens, and the coder sits before it all, God-like and talking in tongues (optional spiked hair and cyber glasses available upon request). Before I started learning to code, I had much the same view. My brain doesn’t naturally work algorithmically, and it felt like an impossible goal to make a script that would complete even simple tasks. I quickly realised the majority of my time was not spent at the command line, but on Google, searching for anyone else who had encountered similar problems. Little did I know that in those many hours spent searching the web, I was actually learning to code myself. The truth is that coding isn’t a specialist skill only achievable by members of the computational elite. Coding is a game of resilience. If you’re a scientist, then you already know the right approach to take.

A successful day of coding (or sewing) for me includes three pivotal steps: 1) enter the problem space, 2) get stuck, 3) try again.

When I started coding, I would Google questions only to find more words I didn’t know. Trying to understand what people meant when they used phrases like “working directories” and “indexing”. The first time I tried to use the simplest of functions in a terminal, I was met with a train made of @ signs and brackets chugging across the screen. I still have no idea where that train came from. Even when I had a basic understanding, I would then spend days staring into the void to find a place to start. Writing out exactly what I needed the script to do, and operationalising more concretely how I can make that happen using mathematics, not a wing and a prayer. Days later and, if you’re lucky, you’ve got an idea of what your script should do and a vague concept of how you can do it.

Now comes the fun part. Write a line of code, run the code, get an error from the code, contemplate throwing your computer out the window, repeat indefinitely. It’s true that for every problem you solve, there will be more waiting. But it’s also true that for every problem you solve, you’ll approach the next one with a touch more experience. It won’t happen overnight, but it will happen eventually. You might have to unpick a dozen seams, re-do your zipper three times, and you might even sew your skirt inside-out. You might need to watch hours of videos and read the instructions a thousand times. The truth you might need to hear is, that’s fine. That’s learning. So, give yourself permission to learn. Like much of life, coding isn’t about getting things right, instead it’s learning how to properly get things wrong.

A successful day of coding does not mean I finish with a working code. That’s a nice side-benefit, and the ultimate aim, but it’s not how I measure success. When I have days of coding that land me roundly back at square one, I often surprise even myself in that I don’t feel unproductive or stupid. I’ve had an entire day learning. Completely out of the blue, it transpires one of the biggest life lessons I’ve taken away from coding is how to be comfortable getting things wrong. How to exist in a problem space and acknowledge the desired goal as one of many potential positive outcomes. It’s one of the reasons I can now say wholeheartedly that I love working on code, and I truly believe it’s made me a better learner. It’s the reason I can fail so well again and again. It’s the reason I can sew a skirt inside-out, and still make it look good. And so, if you’re about to embark on a journey into coding, or really learning anything new, my biggest piece of advice for you is this: try again…

And use Google. Always.

Because the internet loves a numbered list, here’s a few more practical suggestions if you’re looking to get started:

  1. Start simple – for your first time coding, set yourself a ridiculously simple task that you can build on later. If you want to write a full analysis script in R, start by loading in a data file and finding the mean or making a bar chart. Set realistic goals that you can complete early on to build your confidence. This also makes checking the code much easier!
  2. Get stuck in – Though there are many online courses which can be incredibly helpful when learning to code, my preferred method is to just start typing. It can be scary to start with, but searching for functions as you go and problem-solving as needed is still my favourite approach.
  3. Comment EVERYTHING – a professor once said to me “your past self doesn’t answer emails” and it’s very true. You may understand how your code works now, but will you still understand in 6 months? The answer is almost always no. Make sure you keep good notes of exactly what is happening.
  4. Ask your friends – don’t sit and stare at the command line for hours in frustration. If you have friends (enemies, vague acquaintances) who know how to code, ask them for help. Don’t immediately give up at every hurdle, but it’s amazing how often the person sat next to you has the exact piece of information you need to get unstuck.
  5. ChatGPT can be a wonderful springboard – don’t automatically trust code from this source. It will likely need tweaking and definitely needs checking. However, it can provide a good baseline to start from.

Rebecca Williams Profile Picture

Rebecca Williams


Rebecca Williams is PhD student at the University of Cambridge. Though originally from ‘up North’ in a small town called Leigh, she did her undergraduate and masters at the University of Oxford before defecting to Cambridge for her doctorate researching Frontotemporal dementia and Apathy. She now spends her days collecting data from wonderful volunteers, and coding. Outside work, she plays board games, and is very crafty.


What are your top coding tips and resources? I’d love to hear, reply below (note: you need to be registered to post)

Leave a comment

Rebecca Williams

Hello! My name’s Rebecca and I’m a second-year PhD student at the University of Cambridge. Though originally from ‘up North’ in a small town called Leigh, I did my undergraduate and masters at the University of Oxford before defecting/seeing the light (depends who you ask) to Cambridge for my doctorate. I now spend the majority of my days collecting data from our wonderful volunteers, and coding. I maintain that after spending entire days coding analysis pipelines I am very close to actually being able to see the matrix. In my spare time, I am a big fan of crafting in all its forms, and recently got a sewing machine to start designing my own clothes! I also greatly enjoy playing board games, and escape rooms.

Translate »