My two approaches to learning (programming) languages

April 29, 2012

Since I just learned enough JavaScript to do something, I've been thinking about how I get to the point with a programming language where I can do something useful in it. There are two major patterns that I can recognize in my past, which I will call the surgical strike and assembling a construction kit.

In the surgical strike, I focus on learning just enough of the new language (and its libraries) to write the little program that I want. Surgical strikes work best in 'obvious' languages without dangerous surprises, ones that are similar to things I already know, and on relatively simple problems that the languages are good at dealing with. I've started learning a whole lot of languages through surgical strikes, including both Perl and Python.

(For example my first Python program was a quite simple 20-line script to scan a directory and generate a lilo.conf that corresponded to what kernels were there. Yes, this was quite a while ago.)

In the assembling a construction kit approach I spend a bunch of time learning much of the language (and its environment and libraries) in order to build up a 'construction kit' of how to use the language in my area. Only once I've assembled my kit can I actually tackle my real problem and write code. The construction kit approach is what I resort to when I'm faced with a complex environment, a novel language, or a problem that the language is not tuned for. I learned JavaScript (and JQuery) almost entirely this way, because it was clear to me that browser JavaScript is an inherently complex environment and any attempt at a surgical strike would probably produce a horrible mess of hacks.

The advantage of the surgical strike is that it gets me results fast, both solving my immediate problem and giving me firm evidence that I'm getting somewhere with the language. The drawback is that each step doesn't get me very far; it can take a lot of surgical strikes before I actually really know a language (and generally I will stop trying to do surgical strikes at some point and just thoroughly learn the remaining stuff).

The drawback of assembling a construction kit is that there is a lot of slogging before I feel I've actually achieved anything. I at least find it somewhat demotivating to spend a bunch of time reading through (eg) JavaScript and JQuery resources without actually doing anything real; sure, I've read things but that's not actual, visible progress. It's just a slog. The advantage of building a construction kit is that once I've assembled the kit I can suddenly make a lot of progress quite fast because there's a lot I can now build with very little further learning. Once it starts happening this is very motivating and makes a great payoff for all of my prior slogging.

The two are different experiences for me. I wouldn't call one better or worse, although it's easier to stay motivated with surgical strikes.

(Of course one can do things as a hybrid approach, for example assembling a construction kit with the base language and then mostly taking a surgical strike approach with some package or library you need to use. I sort of did this with the JQuery side of my JavaScript learning.)

Written on 29 April 2012.
« ZFS and various sorts of read errors
The Python language tutorial is a gem »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sun Apr 29 02:13:06 2012
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.