Based in Mahone Bay, nova scotia, agile libre is an independent publisher of technical books about the subsurface.  

Learn to program

Two years ago my eldest daughter came home from school and said she’d been programming robots. Programming robots. In kindergarten. 

For the first time since I was four years old, I wished I was five. 

Most people I meet and work with do not know how to make a computer do what they really 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.

I am not suggesting that all scientists should become programmers, coding, testing, debugging, with no time left for 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 mending, rebuilding, 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 learn to 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.

The good news for me and other non-programmers is that it’s never been faster or simpler to give programming a try. There are some amazing tools to teach novices the concepts of algorithms and procedures; MIT’s Scratch and App Inventor projects are leaders in that field. Some teaching tools, like the Lego MINDSTORMS robots my daughter uses, are even capable of building robust, semi-scientific applications. 

Chances are good that you don’t need to install anything to get started. If you have a Mac or a Linux machine then you already have access to scripting languages such as the shell, AWK, Perl, and Python — just fire up a terminal. On Windows you have Visual Basic. There’s even a multi-language interpreter online at codepad.org. These languages are great 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 master it by lunchtime
tomorrow. 

Here are some tips:

  • Don’t do anything until you have a specific, not-too-hard problem to solve. 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 JavaScript; stay away from FORTRAN and C.
  • If you already know or used to know MATLAB, try that — or the free
  • alternative GNU Octave.
  • Buy just one book, preferably a thick one with a friendly title.
  • Don’t do a course before you’ve tinkered on your own for a bit, but don’t wait too long either.
  • For free, online, world-class programming courses, check out udacity.com.
  • Learn to really use Google: it’s the surest and fastest way to find re-usable code and other help.
  • Have fun brushing up on your math, especially trig, vectors, time series analysis, and inverse theory.
  • Share what you build: give back and help others learn.

Acknowledgments

This essay first appeared as a blog post in September 2011, ageo.co/HNxStU

As good as it gets

Age is an interpretation

0