Getting the UK coding
This week is National Coding Week – an annual event that aims to inspire young people to code and build digital skills.
To celebrate, a group of Campus data scientists at various stages of their coding journey talked about their experiences and any advice they have for people looking to start coding.
What interested you in learning to code?
My interest in coding was spurred by the idea of automation of tasks and processes and that a person did not need to be present for actions to be taken to achieve an outcome.
I first realised this while playing a game called Garry’s Mod, where I was able to create automatic item dispensers. In a game, this was very profitable and fun, and the same methods and tools carry over to academic and professional environments, albeit with a bit more seriousness.
What challenges did you face and overcome when coding?
For me, the first steps were the most difficult. When you begin learning to code, you typically do very simple tasks. I could not help but think “What is the point in this? I can do this much more quickly in Excel”. It is only when you get over the initial few hurdles that you realise the true power and potential of coding.
The next challenge was errors. Many errors and lots of intimidating red text. Sometimes, import pandas does not even work first time. For me, coding has always been about problem solving – problem, solution, problem, solution. One thing starts working and another breaks. This can become frustrating, but there is always a reason. It is important not to narrow your vision and to recognise there are usually multiple ways of doing things. Persistence is vital – it is extremely satisfying when your code finally runs.
What advice would you give yourself when you first started to code?
Preserve your code! At some point, you will attempt to make a simple fix to something in your code, which subsequently breaks things that you had working five minutes ago. It will happen. No matter how careful you are, you will find yourself in a position where you have just created a few more hours of work for yourself in a few well-intentioned keystrokes. It is nothing to be ashamed of, and it encourages tidiness later down the line (you will feel so silly, you will not make the same mistake again!).
The easiest way to get around this for a newcomer would be to regularly save timestamped copies of your scripts somewhere as well as any outputs you create (csv data files, for example). Further down the line, using GitHub or Git for version control can be critical but (certainly for me) can be a little intimidating at first!
How can I start coding?
Be nosy. Wonder how things work. How does that game move things around? Where did that number come from? Then, start with something small – make it a small project, a challenge you can set yourself that you would like solved. What is my best time for a run? How often do I buy these ingredients? Can I make the lights come on in the house with my own controller? Can I water the plants on a timer?
You can use a good teaching language (Python is great for this, it was designed for teaching and is very flexible – some might say too flexible), and scale upwards as you learn more. Python, R, Java all have freely available implementations and Integrated Development Environments, so you get a nice working environment very quickly. Once you have got something working and you are comfortable, then start worrying about the more formal side (functional programming, object-orientation, design patterns, loose coupling, unit testing).
Also, try another language. For example, Haskell is a functional language, so it enforces a particular style. Different languages have different pros and cons. Try a few, even if it is just a beginners’ tutorial for an hour – it will really make you reconsider how you code and will help open you up to more possibilities.
How do you keep learning new aspects of coding languages?
I love following my R “heroes” and researchers in the community on Twitter. There are so many interesting developments and applications out there to inspire you and learn! I look out especially for blogs and tutorials that people have made open. As a lecturer, I am constantly learning by teaching. Having to explain coding to students gives me the excuse to dive even deeper into my understanding of a topic and to learn new things!
Another great place to look is YouTube. The RStudio conference makes their talks and workshops available online. You can find me there during a lunch break or when I am looking to solve a new problem.
Because of the impact of the coronavirus (COVID-19) pandemic in our society, there will not be any formal National Coding Week events this year. Instead, this year’s theme is “Fitness and Code”, to help you remember to stay fit while you code. It reminds you to be mindful about your well-being when working at the keyboard.
Whether you are a beginner or more experienced with coding, check out our Github page. We try to make our tools and code available as much as possible so you can use them for your own projects.