I have always been interested in learning to program and as a result have flitted between many different languages without actually settling on one, resulting in a very basic knowledge of a few language but not enough to program anything. I would like to be able to master one then move onto the next one if needed. The languages in which I have dabbled are Java, Assembly, VB, VBsctript, C and SQL. When I say “dabbled” I mean I have read the first few chapters of a reference book, so if you were to show me a piece of code I could probably tell what it was programmed in but not what it does!  I realise this question is very subjective but I would like to know from your experience what language you would learn first? Bearing in mind my aim is to contribute to open source software. Any insight would be much appreciated!

I think the most important thing in learning a language is having the motivation. You mention that you're aiming to contribute to an OSS project, so I'd suggest finding one that you have an interest in ( e.g. if you're into photography, nudge wink, go for a photo editor), and learn the language used alongside trying to understand the project's code. That way, you also pick up useful domain knowledge which can be more complex than the language itself.

Contrary to what DM says again (soz), I'd stay clear of C++ as a first language, as everyone uses it in their own particular way which can be confusing for the beginner. IMHO Python would probably be your best bet, followed by C.

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." --Brian Kernighan

einonm wrote:I think the most important thing in learning a language is having the motivation.

I quite agree. Nothing worse than trudging through a load of dull examples that will never do anything useful (for you).

As to language. Personally I'd choose either Java or C#. These are rich, but strongly typed languages that run on virtual machines (freeing you from the the drudgery of memory management). I'd steer clear of scripting languages like Javascript (horrible object paradigm) or Perl (Where producing the most obscure code is seen as some kind of badge of honour). Python is good, but, IMHO, learning a language with "C" style syntax will give you knowledge that is portable to many more languages.

Personally having enormous fun coding Minecraft (Bukkit) extensions (in Java). The expression on the kid's faces when the chicken they hit explodes with the force of a small nuclear device is something to behold.........

If you'd think you could develop a new gaming platform, then yes: too ambitious But I'm sure developers would welcome your efforts in bug-finding (and -reporting!) to improve their games, or translate it into foreign languages.

I think your first language should be suitable for the type of things you wish to code.

I love coding web apps with php because there's so much open source php code to reuse out there.
If you like making humble games, check out Löve, a game engine you can program with Lua code.
If you want to get into Android development, Java is good investment.

I'm a little like you, I can't keep mind focused on one language while being enticed by others. I'm currently being distracted by newLisp

Have a look at http://www.codecademy.com. It contains many exercises designed to take you from beginner onwards. It has quite a strong web slant (html, css, js, etc.), but has recently published a python track. It is free and I have been using it recently to update my html and css skills.

Bruno wrote:Have a look at http://www.codecademy.com. It contains many exercises designed to take you from beginner onwards. It has quite a strong web slant (html, css, js, etc.), but has recently published a python track. It is free and I have been using it recently to update my html and css skills.

I like Perl and you don't have to programme in an obscure manner. That said what I think is a strength some look as a weakness and that is the Perl philosophy of "More that one way to do it".

There is a wealth of learning material out there and the O'Reilly books are excellent. "Learning Perl" is a really good way to get programming quickly and being untyped and unstructured means you can get doing the stuff straight away. I remember looking at Java and having to write loads of code for "Hello world!" I found off putting.
Others would look at this another way in that having structure and typing forced on you encourages you to programme better.

I agree that its probably best for you to find a project your interested in and then learn the language that is used in that project.

However, if you just want to learn a language with no real project in mind then I would say it depends on what you want to learn, or what you want to do? For example, if your not too worried about some of the lower level stuff, but would rather create nice GUIs then C# or Java (maybe C++) would probably be the best place to start.

Having said that, I found C++ a complete mess when I first started; I didn't really understand what was happening. But having started to learn C, C++ seems to make more sense and so sometimes learning the lower level stuff can be beneficial. As for C# / Java, I found that they were very easy to use but weren't that flexible sometimes, largely due to the lack of pointers. Hence I found that I was often writing a lot more code than I would have in C or C++ to accomplish a particular task. However, that is definitely task dependent. I also found that with C# / Java I didn't feel I "learnt programming", most likely because they are high level languages, I think. So it does completely depend on what you want to learn/do.

In terms of languages like Perl or Python, I believe they are more scripting languages than programming languages, as I don't believe they use a compiler, they just use an interpreter? But I am unsure so perhaps someone else can clarify that - I've never learnt Perl or Python. If I'm right, then I would say if you want to learn programming, a scripting language probably wouldn't the best place to start.