Getting into Programming: Top Tips

By Sarah Louise Brown, University of Manchester

My PhD researches how much organic carbon is processed to the atmosphere within watercourses that receive eroded peat soil, and a large part of this uses a data logger I built and programmed. If you had asked me 18 months ago whether I knew how to program the answer would have been a resounding “No” and in my head I would have added “…and I doubt I ever will”. I’m a Geographer, why would I need to!?

Fast forward to 2019 and while I still consider myself a novice, I have a decent enough understanding of programming and an aptitude in the programming that meets my needs. My needs are mostly hardware, e.g. Arduino or Rapsberry-Pi mini-computers wired to various environmental sensors but I also work in ‘command line’* based software such as LaTex, Matlab and R.

If you’re interested in programming or have a question you think could be answered with programming but don’t know where to begin, I’ve written some tips on how to get started.

  1. Start Small. The first piece of programming I ever did on my own, without attending some kind of course beforehand (see #3), was programming a Rapsberry Pi to write the classic “Hello World!” on a screen in front of me. The second was getting the built in light to flash on an Arduino. The code for the latter is included on the Arduino board so I didn’t even have to type anything! Working with Excel-style data in MatLab is another thing to try. These smaller activities help you learn to navigate the software you write code into. My PhD research is more complex but I added each aspect of my data logger sequentially, giving myself many smaller successes and I didn’t feel overwhelmed. Start with small tasks designed to build your aptitude and work towards your end goal gradually.
  1. Copy other code. The wiki article about ‘copy and paste programming‘ sounds quite derogatory and was probably written by someone who considered themselves the Architect of the Matrix. But why write new code when old code will do? Github and Adafruit are astonishingly useful resources for open-source code and many electronic components come with downloadable content. However, it could be easy then to go through your programming life never really knowing what any of your code does, leaving you unable to fix your own equipment or program. As you borrow code, read through it to understand the structure and purpose of each line. Most code allows you to make comments, so make sure you write down what each section/line does e.g. give it a title and write notes clearly. This will help you become a better and faster coder, but will be beneficial when you return to your code or if you want to build upon it later.
  1. Take an introductory course in any kind of command line software. Many universities offer introductory courses to programming softwares, or there are a lot online e.g. Datacamp. My first experience with anything that used a ‘command line’ was MatLab and this familiarised me with the format of typing something in a specific format and the software following this instruction. During my PhD 1st year I took an ‘Introduction to LaTex’ course, a word processing software based within a programming environment. These two were excellent starting points when I made the journey to Arduino programming and more recently R, because the basics (such as: types of data, what code libraries are, knowing to always check brackets when you get an error message, and the best search terms to use online to solve the problem I was having) were already in my head.
  1. Check online when you get stuck. If you’re stuck on anything programming, Google is seriously your friend. Any problem you are having, someone else has also had that exact same problem and another person has solved it on an online forum (see Stack Exchange). The worst thing you can become is disheartened because you feel like you’ve reached the end of your ability, but a PhD can be about educating YOU as well as pushing the boundaries of human knowledge and taking time to solve problems can have unexpected rewards for your research.
  1. Understand what you want to do with programming. You don’t need to become a pro to make programming useful to you. PhDs are often time pressured and I wrote at the start of this blog post I have ‘an aptitude for the programming that meets my needs’, and this is because I try to make programming something that saves me time rather than something that I have to put lots of time into. If your research goal involves managing and investigating large datasets, especially through repetitive maths/stats or data fitting, you might find learning R (or RStudio) useful as it won’t crash as often as Excel and you have more control over data fitting and graphical outputs. I didn’t need to learn e.g. how to make webpages, or how to connect my datalogger to WiFi, to answer my PhD’s core research questions and I have kept this goal in mind.

 

Sarah Louise Brown, University of Manchester Geography Department. Thanks to Svenja Riedesel for helpful comments.

Email: Sarah.Brown-2@Manchester.ac.uk

LinkedIn: www.linkedin.com/in/sarahlb

Twitter @Brown_SL_

 

*A command line is a way of interacting with a computer or software where you write instructions in coded text format.

 

Leave a comment