More thoughts about learning (computer) languages...

2010-09-22 19:51

I’ve picked up a fair number of programming languages. In recent years, though, I’ve noticed something: They’re getting easier. Now, before you jump out and say “of course, language design has improved”, I’m not talking about improvements in language design; I’m talking about a shift in what my brain does when confronted with a new thing which looks sort of like a programming language.

I think some of it is just that it’s harder and harder for people to come up with something that’s unlike anything I’ve seen before. I’m a couple hundred pages into a book on Python, and I’ve seen one construct so far that I don’t think I’ve seen in other languages in a recognizable form, but honestly I think at least a couple of the languages I know could probably do something functionally quite similar.

I’ve also noticed that ease of learning new languages doesn’t seem to affect how much I like or dislike them, so far. PHP was pretty easy to pick up, but I find it loathesome. Python is pretty easy to pick up, and I don’t really like it, but I find it pretty tolerable. If I had to code in Python for a few months, I wouldn’t spend the whole time frustrated and annoyed; that’s a lot nicer than anything I could say about PHP.

The question of what makes a language likeable is pretty thoroughly non-obvious. It’s not high level languages with simple syntax; I love C, and even though I’m moderately fluent in several high level scripting languages, I still often use C for “trivial” programs — even ones that involve string manipulation or set manipulation, which are much, much, easier to do in something like Python or Ruby. It’s not lack of quirks or annoyances; I’m happy to rant about the various flaws in C, but I recognize the sound technical reasons for which most of them can probably never be changed. (Hundreds of millions of lines of installed sound technical reasons around the world…)

FWIW, some time further in, I’m still not really liking Python. I’m not disliking it particularly, though, and from me, that’s probably actually sorta complimentary.

Something I find myself wanting, though, is a gigantic table of idioms in Perl, Python, PHP, Ruby, Lua, and maybe C, which shows roughly how to translate some common idioms from one language to another. Not that every idiom is portable to every language…

/* translate this to Python, plx? */
	int n=(count+7)/8;
	switch(count%8){
	case 0:	do{	*to = *from++;
	case 7:		*to = *from++;
	case 6:		*to = *from++;
	case 5:		*to = *from++;
	case 4:		*to = *from++;
	case 3:		*to = *from++;
	case 2:		*to = *from++;
	case 1:		*to = *from++;
		}while(--n>0);
	}

(Slightly modified from the original, because register is no longer meaningful to most people.)

Peter Seebach

---

Comment

 
---