Here is one little tip you might not know: programming languages, like spoken languages, have accents.
Well, maybe I’m stretching the metaphor a bit. But only a bit. So bear with me while I dissert a bit about spoken languages. I promise it won’t take too long.
A brief detour on Spoken Languages
I was born in the southern part of Spain. That region, known as Andalusia, has it’s own accent. It has a distinct intonation has certain slang, but its most prominent characteristic is the omission of phonemes. I guess, to other Spanish speakers, Andalusian Spanish sounds like a mixture of Scottish and Texas English. It is also kindof considered “funny by default”. Some comediants use that accent to tell jokes, even if they don’t usually speak like that.
In addition to Andalusian, after spending 9 years in Madrid, I have a separate “compartment” in my head for Madrid’s accent, which we could call “neutral Spanish”. I change between Andalusian and neutral depending on who I am speaking to.
I also speak English and French. I only have one accent for each of those, but I know them well enough to notice how different accents sound.
This linguistic background has allowed me to notice certain … differences here and there. Besides the obvious ones, like phonetical or grammatical rules, I mean; more of the semantic kind.
For example, French people (at least people from Paris, which are the ones I’m more familiar with) don’t even say “we”. I mean, they have a word for it – “nous”. But they never use it when colloquially speaking. Instead, they use the impersonal “on”, which roughtly translates to “it” (as in "It is said that… "). So, when they mean “let’s go shopping” they say something like “it should go shopping”. Crazy, right? Well, they do it all the time.
What can I say about English? It is so widely used that there are so many things one can say. By hearing how they pronnouce the letter “r”, one can say whether someone is from one side or the other of the Atlantic. I wonder if some day “I wanna go” will be considered valid English.
In Spain, no one says good-bye any more. There is a word for it, of course – “Adiós”. But no one says it. Everyone says “see you soon” instead. Even if it’s longer. Society has decided that “Adiós” is too … hard, I suppose.
They say eskimos have 7 different words for “snow”. I don’t know if it’s true. I know that my girlfriend, who grew in the northern part of Spain, has 1 more word than me for saying “it rains”, in Spanish.
The Engineer View
I like to think that all men of science share a special sense of beauty. Instead of (or in addition to) being able to find beauty in a work of art, we find it in efficient, neatly organized systems and tools.
When I look at spoken languages from the point of view of an engineer, I find them a bit … lacking. Spoken languages are not a very efficient tool for communicating concepts. They require more effort than it’s really necessary.
Spanish verbs are crazily ornated. English does it better, but still requires too much memory – why say “I am, you are, he is”, when you could say “I be, you be, he be”?. Speaking of English, its pronnounciation rules have too many exceptions and things that one has to remember – tomato vs potato. That one is much simpler in Spanish. My biggest grip with French is that even if lots of words are pronnounced the same way, they are written differently. The fact that the word “bureaucracy” has its roots on that particular language makes a lot of sense.
Programming languages as tools
When I look at programming languages, I conserve that sense of beauty. That is why I consider myself very fortunate to be able to work with a programming language that I find aesthetically pleasant as an engineer. I enjoy using the language, and seeing where it takes me.
Lua is another language that I enjoy. It is smaller than ruby, and certainly less powerful, but the compromises it makes reflect what I think an embedded language should do.
And of course there are plenty of others. Lisp. Haskell. Erlang. Html. Even CSS.
The point is, I have grudges with all of them. It would seem that I am doomed to never be satisfied.
The accent in programming languages
But I wanted to talk about the accent in programming languages. As I was saying before, I think that there are “semantic differences” between spoken languages. And I think those differences are even more pronnounced in programming languages.
The first programming language I ever learnt was BASIC, in the mighty Spectrum 48k+ . Much later, in the University, I learnt C. And I programmed C exactly like I programmed BASIC before. Then I learnt Java … and yet, I managed to program it as if it was BASIC. Only though time, and gradual effort, I managed to “get” this new “way of thinking” called “Object orientation”.
… and then I started to do Object Orientation in plain C. Which was a mistake.
To get the nature of a programming language, you probably should not use a grammar book. You will need a book which concentrates on “idiomatic rules” instead. Or, you could spend an inordinate amount of time reading other people’s code.
So, when you learn your next programming language, don’t stop after you learn the basic grammar rules. Try to concentrate on whether people say “Adiós” with it. Or how many ways it has for saying “snow”.