views:

251

answers:

10

Hi,

For a programmer familiar with at least 2-3 programming language, there are many ways to learn a new one:

  • On-line tutorials
  • Theoretical background reading
  • Reading and writing code
  • Wikipedia
  • University course
  • The language book (e.g., K&R for c)
  • Community wiki (thanks, NB)
  • And probably many more...

What's the best way to get started? Is there a canonical answer, or is it language and student dependent?

EDIT

+5  A: 
  1. Find a programming project that (a) is interesting to you (e.g. build a command line utility/web app/sudoku solver) and (b) is a good fit for this language.
  2. Do that project, using whatever reference materials are necessary.
RexE
And get a book once you decided which language to learn.
Dykam
+1  A: 

Writing Tetris

WW
Heh - C was pretty much my first programming language, and Tetris was the first non-hello-worldish program I wrote in it - so this is exactly what I did.
Anon
+8  A: 

As with all learning processes, it's going to depend upon the student. It will also depend on just how familiar you are with those existing languages, and whether there's a major paradigm shift between languages. For example, someone well-versed in C# and Java might stumble at first when learning a functional language like Lisp, or a logic language such as Prolog, because the entire approach to problem solving is different.

In terms of learning the language, one can pick up the syntax and grammar fairly quickly, either with an online tutorial or a good book; many resources exist for languages which act as "conversion course" material - that is, rather than cover subjects such as "this is a variable", they take the perspective of, "this is how we declare variables in this language".

Of course, learning the language and its associated idioms requires more than just pure syntax; you're going to want to learn the entire platform; the supporting libraries and API, if you want to get anything productive done. For example, learning C# is all well and good, but if you don't bother to learn part of the .NET framework in the process, you'll struggle to do anything really interesting. Fortunately, someone well-grounded in the language basics can usually pick up platform specifics fairly easily, as long as the documentation is reasonable.

In the long term, the best way to get really comfortable with a language and platform is to code a lot in it; several small projects to get used to the various idioms and best practices for different common tasks, and then perhaps one or two medium-sized projects to give you a chance to challenge yourself. Of course, developing true language expertise will take many, many years...but I think I've discussed this before.

Rob
A: 

Today most languages have extensive tutorials provided by either community or developers. I think they are a good start. After you are gone through tutorials you can get a book about this language to improve your knowledge.

But note that without actual on-hand experience with language you will never be able to move past certain level, because you can only get all the quirks of the language yourself.

I believe that theoretical background knowledge in CS/algorithms or/and mathematics will only help in learning programming language.

Also when learning new language it is important to focus on semantics of the language, rather than on syntax. If you understand the semantics - syntax will be just a matter of getting used to it.

freiksenet
A: 

My steps would be:

  • Get familiar with the syntax, by reading and modifying basic applications: Tic Tac Toe kinda stuff.
  • Find a good IDE to help you discover more of the language. For instance learning C# without Visual Studio would be much harder.
  • Get a taste of design patterns, and have a look at some of the more complex applications to get an idea of what are best practices.
  • Read more about specific language features

Books, tutorials, webcasts are all useful. Make sure it's a good combination of theory and just writing/trying to code some of it yourself.

Zyphrax
+3  A: 

One possible way is to program a list of exercises in the new language. SmartProgrammer posted a list of exercises. Larry O'brien did not like the list and posted a more thorough one.

Yuval F
That's really great. I'll refer to both lists, they are quite interesting.
Adam Matan
A: 

It can be language dependent, but generally I:

  • Find a good book on Amazon that has good reviews - although there are often a wealth of materials online, I want something that I know is reputable so I don't get into any bad habits or practices from the start.
  • Work through small projects after I've finished reading the book, usually to fulfill some purpose or create something that I need - in this way I am more focused and geared towards creating something I want to than something simply by the book that I'd find monotonous.
  • Keep reading resources online to further my knowledge of the language; often books can't go into every single detail of the language, so finding articles or resources that lead you into more advanced topics are good for developing your knowledge further.
  • Take a look at other projects to see how they work, to ensure that I use commonly known and used paradigms for tasks (if they exist).

Of course if you have understanding of other languages already, this process should be easier, since at least some of the designs and principles of languages are transferable.

Perspx
A: 

Solve your own problem. I'm not being rude, but you have to have a reason for you to learn it. For example, if you're sick of doing the donkey work of connecting to a database, querying it, outputting the results to the screen with controls, etc, you're going to be motivated to learn a framework or a language that 'does it better'. "Better" might be easier, faster, cheaper.

I'm a web developer. I used to like programming with Perl. I'd create complicated flat file databases to store things because that was my "level" with Perl; I knew what I was doing, I knew that it was limited and I wanted to progress. So, I ventured into proper databases (like MySQL). This, at the time caused me to move to PHP. Only recently, I've decided that I want to learn Ruby because the Rails framework appears to save an awful lot of time. They are my reasons, and they have flaws!

But your reasons will suit you. With the right motivation you can pick up a language quite quickly. The 'right' resources will help. For me with Perl it was the O'Reilly Programming Perl book. With PHP, it was http://www.php.net. With Ruby, I have the Pickaxe book and The Pragmatic Programmers "Rails for PHP Developers" book. I think there is a severe lack of non-technical, non-API style documentation for Ruby and Rails though, however I have digressed!

Gav
A: 

Reading and writing code about a new language

plan9assembler
+1  A: 

I would port a project to the language from a language you know well. You'll always have a reference that you understand thoroughly.