Skip to main content
  1. blog/

J.K. Rowling's 8 Rules of Writing Code

Calling Joanne K. Rowling an amazing writer is certainly an understatement. Her Harry Potter universe is a fascinating world and I personally really love the Cormoran Strike novels that she started to publish under a pseudonym. Recently, I happened to stumble over a blog post about Joanne K. Rowling’s 8 Rules of Writing - and realized that they actually also apply to writing code for data analysis. Below is the overview with a few subtle tweaks in italics and bold…

  1. Be ruthless about protecting writing days coding hours, i.e., do not cave in to endless requests to have “essential” and “long overdue” meetings on those days. The funny thing is that, although writing data analysis has been my actual job for several years now, I still seem to have to fight for time in which to do it.
  2. You’ve got to work. It’s about structure. It’s about discipline.
  3. I stopped pretending to myself that I was anything other than what I was, and began to direct all my energy into finishing the only work that mattered to me.
  4. Write what you know: your own interests, feelings, beliefs, friends, family and even pets domain knowledge, past work and your knowledge about the data collection process and method will be your raw materials when you start writing.
  5. I always advise children who ask me for tips on being a writer to read code and analyses written by others as much as they possibly can. Jane Austen gave a young friend the same advice, so I’m in good company there.
  6. Perseverance is absolutely essential, not just to produce all those words lines of code, but to survive rejection and criticism.
  7. What you write becomes who you are what you need to need to fine-tune, deploy into production and maintain… So make sure you love what you write!
  8. Failure is inevitable — make it a strength. You have to resign yourself to the fact that you waste a lot of trees hours with data cleaning, exploratory data analysis and developing dozens of preliminary models before you write anything you really like, and that’s just the way it is. It’s like learning an instrument, you’ve got to be prepared for hitting wrong notes occasionally, or quite a lot. I wrote an awful lot before I wrote anything I was really happy with.