By Leanne Wake, Software Sustainability Institute Fellow, and Anniversary Research Fellow, University of Northumbria.
Apparently it was Abraham Lincoln who said "If I had eight hours to chop down a tree, I'd spend six hours sharpening my axe". It's not just tree felling that requires preparation, the phrase applies equally well when learning to code. But then what about those of us who don’t have axes... and what if I spend all that time sharpening and then don’t need the axe again?
Initiatives such as the Hour of Code held during Computer Science Week (9-15 December 2013), being promoted here at Northumbria University by Dr. Claudio Benghi, attempt to get people started with coding. Unfortunately, we found the uptake was fairly disappointing, so it got me thinking about we can do to lead these horses to water.
Why teach coding and Software Carpentry?
A report from NERC listed the three most-wanted skills from postgraduates in the environmental sector as modelling, multidisciplinarity and data management. In my opinion, these skills can be linked by making progress with software education.
Modelling: effective and imaginative operation of physical models requires the confidence to understand, delve into and modify current code, and that confidence comes from experience. Multidisciplinarity: during my postgraduate education, I found the ability to follow code - with or without good commenting - was as useful to me as reading textbooks or journals that provided the theoretical background knowledge about the physical process I was studying. Data Management: during the move from undergraduate to postgraduate, my datasets had outgrown Microsoft Excel. I had the bare minimum of C-Shell and FORTRAN training at second year undergraduate but event with only that experience I managed to scrape by.
How to teach it?
Dr. Claudio Benghi began our Hour of Code session with a gentle introduction to the Microsoft Visual Studio environment, which uses a point and click approach to building code. This, I believe, is one of the most important elements: although you are in a friendly point and click environment, Microsoft Visual Studio is implicitly producing lines of code.
A simple example of adding a button and then displaying text when it was clicked led to the more complex step of introducing libraries from the Northumbria University xBIM toolkit into the Microsoft Visual Basic environment. This toolkit allows users to view and create Building Information Models (BIMs), is open-source and operates in the C# and C++ languages. A section of code was demonstrated where you could search through a particular BIM and extract desired information using do and if statements.
GUIs as the first step in coding education
The use of a GUI (graphical user interface) when teaching code appears invaluable when teaching beginners about code. For me, the strength of this approach was conveyed by Dr. Claudio Benghi "the complexity of code is overestimated when we are not aware of the basic principles". I was not exposed to a GUI coding environment as an undergraduate Geophysicist, so coding was a non-intuitive, educational step-change from the comfortable point and click environment I was used to. Using a GUI as the first step in teaching code allows you to move away from line-by-line construction.
The next challenge, which I’m not sure was specifically met, is to convince new users that the time invested in learning to code is worth it. Many of my colleagues now wish that they were taught more coding as undergraduates. I’d like to echo what a fellow-Fellow (Dr. Jane Charlesworth) published in a blog earlier this year. Jane commented that much of her biology training was located in a wet lab environment, but she didn't work in that kind of environment post-degree.
I was exposed to a broad range of subjects in the area of geology and geophysics, but no coding techniques (partly because the coursework did not consist of analysing large datasets). Geological mapping, producing subsurface cross sections (now possible with ArcGIS) and seismic picking of refracted horizons were carried out with pencil and paper. It was only during my Masters and doctorate that I carried out computationally intensive analyses. And I believe that this is too late to start to learn code. It is perhaps reasonable to assume from NERC’s 2012 Most Wanted Skills report that very little has changed in the intervening years for graduates of environmental sciences.
Any suggestions regarding how to introduce code to beginners and to encourage participation are welcome in the comments section.