Agile

View Original

Learn to program

This is my contribution to the Accretionary Wedge geoblogfest, number 38: Back to School. You can read all about it, and see the full list of entries, over at Highly Allochthonous. To paraphrase Anne's call to words:

What do you think students should know? What should universities be doing better? What needs do you see for the rising generation of geoscientists? What skills and concepts are essential? How important are things like communication and quantitative skills versus specific knowledge about rocks/water/maps?

Learn to program

The first of doubtless many moments of envy of my kids' experience of childhood came about two years ago when my eldest daughter came home from school and said she'd been programming robots. Programming robots. In kindergarten. 

For the first time in my life, I wished I was five. 

Most people I meet and work with do not know how to make a computer do what they want. Instead, they are at the mercy of the world's programmers and—worse—their IT departments. The accident of the operating system you run, the preferences of those that came before you, and the size of your budget should not determine the analyses and visualizations you can perform on your data. When you read a paper about some interesting new method, imagine being able to pick up a keyboard and just try it, right now... or at least in an hour or two. This is how programmers think: when it comes to computers at least, their world is full of possibility, not bound by software's edges or hardwired defaults.

Stripped down cameraI want to be plain about this though: I am not suggesting that all scientists should become programmers, hacking out code, testing, debugging, and doing no science. But I am suggesting that all scientists should know how computer programs work, why they work, and how to tinker. Tinkering is an underrated skill. If you can tinker, you can play, you can model, you can prototype and, best of all, you can break things. Breaking things means learning, rebuilding, knowing, and creating. Yes: breaking things is creative.

But there's another advantage to learning to program a computer. Programming is a special kind of problem-solving, and rewards thought and ingenuity with the satisfaction of immediate and tangible results. Getting it right, even just slightly, is profoundly elating. To get these rewards more often, you break problems down, reducing them to soluble fragments. As you get into it, you appreciate the aesthetics of code creation: like equations, computer algorithms can be beautiful.

App Inventor blocks editorThe good news for me and other non-programmers is that it's never been faster or simpler to give programming a try. There are even some amazing tools to teach children and other novices the concepts of algorithms and procedures; MIT's Scratch project is a leader in that field. Some teaching tools, like the Lego MINDSTORMS robotics systems my daughter uses, and App Inventor for Android (right), are even capable of building robust, semi-scientific applications

Chances are good that you don't even need to install anything to get started. If you have a Mac or a Linux machine then you already have instant access to scripting-cum-programming languages like the shell, AWK, Perl and Python. There's even a multi-language interpreter online at codepad.org. These languages are very good places to start: you can solve simple problems with them very quickly and, once you've absorbed the basics, you'll use them every day. Start on AWK now and you'll be done by lunchtime tomorrow. 

For what's it's worth, here are a few tips I'd give anyone learning to program:

  • Don't do anything until you have a specific, not-too-hard problem to solve with a computer
  • If you can't think of anything, the awesome Project Euler has hundreds of problems to solve
  • Choose a high-level language like Python, Perl, or perhaps even Java; stay away from FORTRAN and C
  • Buy no more than one single book, preferably a thick one with a friendly title from O'Reilly
  • Don't do a course before you've tinkered on your own for a bit, but don't wait too long either (here's one)
  • Learn to really use Google: it's the fastest way to figure out what you want to do
  • Have fun brushing up on your math, especially trig, time series analysis, and inverse theory
  • Share what you build: help others learn and get more open

Bust out of the shackles of other people's software: learn to program!