Want updates? Opt out any time

News
« The cratering hypothesis | Main | Four days of oil »
Wednesday
Sep282011

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!

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (7)

Fantastic post Matt, thank you for the goodies!

September 29, 2011 | Unregistered CommenterMatteo

As someone just starting into geophysics, this was a really useful insight! Thanks!

October 8, 2011 | Unregistered CommenterHelena

@Matteo: You're welcome, as always! @Helena: Glad you got something out of it. Good luck in mastering the art... I hope you blog about it :)

October 8, 2011 | Registered CommenterMatt Hall

This is very interesting: MIT open course - Introduction to Computer Science and Programming

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/

January 17, 2012 | Unregistered CommenterMatteo

@Matteo: I've been diving back into iTunesU recently. Totally amazing content, like whole computer science courses at Stanford and MIT. It really makes you wonder if you need to go to university anymore, at least for some kinds of education. Course notes, labs, everything is online.

Anyway, thank you — I will watch some of these. Intro to OOP, Pylab and plotting, Monte Carlo simiulation... so much greatness!

January 17, 2012 | Registered CommenterMatt Hall

Thanx for this magnificent post.
Well I will add another powerful language yet easy to learn << SCILAB>>. This resembles to Matlab and Octave. It's Free and is available for all the platforms. It's quite easy to learn as compared to Python!!!!!! (For novice Python offers difficulty somehow).

July 29, 2012 | Unregistered CommenterToqeer

@Toqeer: Thank you for the link — I hadn't heard of Scilab. I will check it out, especially as the new company Scilab Enterprises seems to have a sort of open source enterprise going on — selling services, training, and other things on top of an open platform.

Python difficult to learn? You're the first person I've heard say that! I suppose I can see how getting set up, and things like vector math (and other MATLAB-like things) might take a bit of getting used to... is that the sort of thing you mean? But once you have NumPy installed, it doesn't seem a lot harder than these other high-level languages.

Cheers!

July 31, 2012 | Registered CommenterMatt Hall

PostPost a New Comment

Enter your information below to add a new comment.
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>