views:

619

answers:

37

A few days ago I came over this question:

Did you ever switch from one programming language to another?

and it seems, that almost everyone had this problem more than just once.

What is your starting point for learning a new,

  1. similar (i.e. C to C++) or

  2. completely different (i.e. Perl to JAVA)

new programming language?

Do you use webcasts, ebooks, printed books, online tutorials, courses,...

+8  A: 

I start writing code. Solve some Project Euler problems, write whatever random tools I need at the moment, implement common patterns I use all the time, etc. To learn things as I go, I use whatever documentation is online.

Cody Brocious
A: 

I generally look for Web casts or e-learning sites such as VTC. This has helped me a lot! When i went from Java to C# and ASP.NET i used asp.net/learn and VTC for this. I find Video Tutorials and others discussing the programming language I want to learn, be a good way of getting good information!

Filip Ekberg
A: 

First I read basical sources, to see "how it looks". If it looks "as C", I skip the firsts tutorials I find using google. Sometime I spend time at the bibliotheque, so I have a look on the "standards" for the language.

For instance, for perl, I learned the data structures, then I wrote some small programs. And after that, I began with language specificities, one liner and so on.

If I really don't know the language (like Caml for me), I read basicals tutorials for beginners (data structure, function declaration, conditionnals) and then I make some stupids programs, after what I look code.

I don't like webcast, because the sourcecode isn't readable (imo).

So : online tutorials, printed books, ebooks, and school for me.

Aif
A: 
  • Examples from others

  • The man Unix command, especially useful for perl or tcl/tk

  • books or ebooks

  • writing code

mouviciel
A: 

Web Dev as a career is about learning new languages every year.

Almost invariably online tutorials (not references at first) on one monitor with an IDE and a blank new project (or equivalent) on the other monitor. It's really, critically, amazingly important to actually be coding as you're reading imho.

If it looks familiar enough I just focus on the obvious differences and work out the subtleties as I go. If it's completely different in syntax or concept I'll work things out starting at helloworld.

annakata
A: 

If it is totally new, then I prefer to get some book for beginners/dummys. Even if the language is the same, but different environment - like switching from Windows to Symbian. It's still C++ and all the for(), if/else applies, but otherwise it's totaly alien. Reading such beginners book gives unhurried view of the new settings.

After that I prefer to start with some real-life project. That's the best way to learn the really important things. "Hello world " samples are not worth the trouble.

Riho
A: 

Find out what is the most recommended book on that language, skim read it, write some code, read a bit more, write some code etc.

The only way to learn a language is to use it. Be prepared to throw your code away and also be prepared to go back and rewrite.

Find a mentor as well

Fortyrunner
+1  A: 

Once you can program in a couple of the language classes (procedural, object oriented, functional, logic) then picking up new languages is usually done on demand and learning the basic syntax and concepts usually doesn't take long. Your typical CS degree programme will include a language in each of those classes at least so even if you haven't touched functional programming for ten years the memories will come flooding back quickly enough.

With modern languages the important thing is to learn the core API, which is vast these days. It's well worth reading over and taking notes on the main API classes/methods/functions. Also worth finding articles or books regarding pitfalls in that language, as well as best practice.

If you learn a new major API each year, even within a single language, I think you are keeping up with the suggestion that programmers should learn a new language every year, at least in spirit. And never at the risk of being a master of nothing :)

JeeBee
A: 

I was introduced to programming through a dialup program called “Telix.” Telix, had a scripting language called “SALT.”

Later when the web became popular, I wanted to put a web site. So I learned HTML. From there it grew. The next was how do I connect a database to my web page – I learned PHP and MySql.

The applications started to get bigger, almost out growing PHP. I had an opportunity to learn VB.NET. Shortly after learning VB.NET I switched to C#, which I’ve been working with ever since.

All of my learning was self motivated. When I first started, the internet wasn’t this large orgy of knowledge, googling it wasn’t an option. Everything had to be figured out. Luckily when I started learning HTML, CSS, PHP and Mysql there was already a good size of web sites on the net that had posted articles. There was one forum site that was instrumental in my learning: http://sitepoint.com by far one of the best resources for web development.

When I started windows development I moved away from Sitepoint. The first book I started with was SAMs ASP.NET unleashed. It’s a great place to start, if you into web development on windows.

Happy Coding!

Chuck Conway
A: 

I tend to read books about what i want to learn, doing all the examples and exercises in the book. Then i write my own programs using what i've learnt.

By the way thanks for the Project Euler link, i'm gonna give them a go.

J

A: 

First things first. Determine if the PL is totally new(compared to what you already know ofcourse) and with what motive was it created. How to do that? Read the motivation/intro/preface pages in the ebooks you are going to download from the internet. You can also get this introductory info from podcasts or articles. This info will give you an overall picture of the PL and what problems it was designed to solve, how it differs from other existing PLs and which other PLs it is similar to. This info is always there and you can always find it. After that, you would be aware of the new concepts that are available in the PL that you need to familiarise yourself with. Learn these new concepts and then solve simple problems using the language like creating an employee info system that saves, updates and deletes employee records in a DB. Write programs and only refer to the books when there is a need. Say when you are stuck with the syntax for doing something. This is most helpful for a similar language but for a totally different language, you might need to read about the syntax first and understand its patterns and flow before you start to practice with it solving problems.

Define new increasingly challenging problems that require more advanced ways of solving them and then refere to the books on how you can solve them. Write the code. Do this till you are fed up with the language!

Remember to understand the WHY first of the PL before you do anything to do with the PL. This will guide you to learning fast and getting deeper understanding.

Lonzo
+17  A: 

I try to write a non-trivial app that forces me to dig deep into the documentation.

Bryan Oakley
+1 - By building something you actually might use, you tend to have to dig to accomplish the more complex parts, which expands your knowledge, and leads you one more step down the path to mastery.
Mr. Matt
+1 - Agreed with you. Awesome way to learn a new language. You're more intrigued to learn something if you have a practical use for the language. I've done this for C#/VB.NET, which I have a job doing now, and C++, which I do on the side for pet projects. :)
Zack
+4  A: 

Like a famous shoe company:

Just Do It

Dive right into it, with any references you need, and code something!

Matthew Jones
+7  A: 

Give myself a problem to solve and try and solve it.

DeletedAccount
You got a problem, yo, you'll solve it. Check out the bits while your debugger revolves it.
Ben M
+1  A: 

I look for tutorials. I'm all but completely stopped buying books because most of the information you need can be easily found on the internet for free.

So to learn a new language (or framework or technology) I usually just go search Google and start reading tutorials and blog posts about it. Usually you can find a good "quick start" or some tutorial that will tell you how to setup your environment and get going. After that I just keep playing with it and mimicking the examples until I learn it enough to do my own thing.

Max Schmeling
+1  A: 

first time I learned a programming language (it was BASIC by that time) when I was 10 years old, I used the same way I still use till the moment.

Get code samples, compile or run, see the results, hack into arguments and study the differences

A.Rashad
+2  A: 

Buy a book and start writing a non-trivial app with that language or tool try to choose a brand new app that you have never written before , encounter problem and find its solution

Adinochestva
A: 

Start with a book. Read forum
question in that area, this gives you an idea how that new language works, you will get a feel of it. Try
examples. start with as simple as - Hello world.

I tried Selenium IDE, RC the same way. It's a automated testing tool.

Broken Link
A: 

port all your apps to the new language. This ALWAYS works for me and seems to have the shortest learning curve (about 2 weeks to adequate fluency)

ennuikiller
A: 

I take usually take the following steps:

  1. Read some introductory topics about the language to get a feel for how things work, design guidelines, etc.

  2. Start with a trivial app that gets your feet wet, but make sure it's something you'd like to build upon.

  3. Start building out the trivial app. Make it something non-trivial by adding functionality. It will force you to dig into documentation, put in to practice the coding guidelines, and give you a good feel for how applications scale when you start adding functionality (and how to refactor them when needed).

Justin Niessner
+3  A: 

I'll Google around to see which are good tutorials for language X. Then I read one of these tutorials. Then I'll make some Project Euler assignments (always trying to do them in successive order), and then I'll read another tutorial. This will get me started with the basics. Then I'll attempt something bigger.

Really, it's all about practice.

Stephan202
Project Euler is always a great place to practice a new language.
280Z28
+4  A: 

Lie (or "mislead", if you like) your way into a job that requires you to know this language. You will have no choice but to learn it quickly. This is how I learned SQL back in the day.

MusiGenesis
Ha. Though potentially unethical/dangerous, this is good advice. If you know you're capable, then putting yourself in a do-or-die situation can push your brain into overdrive.
Donnie DeBoer
I only made one tiny mistake my first day: neglecting to add a WHERE clause to my DELETE FROM statement. Actually two mistakes, if you consider experimenting on a production database to be technically a "mistake".
MusiGenesis
Though, to clarify, I would never suggest lying about your knowledge. Instead, emphasize your ability to learn quickly and your understanding of CS principles...
Donnie DeBoer
I would never advise a candidate to lie to me personally about their technical knowledge, but that's partly because I ask questions like "what's the difference between HAVING and WHERE in T-SQL?", as opposed to "how well do you know T-SQL?", so lying to me would be useless.
MusiGenesis
@MusiGenesis, never do the delete without proofing it using a select first only once your select returns the data you wish deleted do you change the "Select *" to "Delete"
BenAlabaster
Thank you, balabaster. I have learned this and a few other things in the 14 years since this occurred.
MusiGenesis
A: 

I generally find a tutorial to acquaint myself with the general syntax and logic, then start writing programs to do various things (I generally don't have any specific thing chosen ahead of time; I generally just go with what I feel like doing) and referencing the documentation when necessary.

JAB
+1  A: 

For languages I tend to do something like this:

  1. Install the compiler/interpreter.
  2. Start reading a short tutorial while periodically playing around with the language features by writing trivial programs (fibonnaci, fizzbuzz, helloworld, etc). If I'm bored at this stage, I move on to something else, otherwise I keep going.
  3. Find a short book or long tutorial and read through it as fast as I can. The goal here is not to memorize everything I read, but to soak my head in the ideas.
  4. Write some small but non-trivial project. When I get stuck, hopefully it'll trigger some vague memory of something from stage 3, and I'll go back to the text.

To get good, I need to repeat stage 4 with more ambitious projects over and over for around ten years.

Will Harris
A: 

I've found that porting an existing application (that you wrote) is a great way to learn a new language. Since you are porting, you already have the application design work done. This frees you up to focus on language specifics.

Donnie DeBoer
A: 

I aproach it looking for tutorials using google and after one or two, I start to look for some open source project that uses that language to see how is used in an non trivial system and then start using it.

Aragorn
A: 

Once beyond the basics, I will start to follow Q&A forums (like StackOverflow) on the specific language/subject. Often, the questions will just point me to areas of the language I need to explore furher. Once I understand the questions, the answers bring me further along. And if I find myself answering some of the questions, that's a good sign.

Ed Schembor
+6  A: 

I take a job doing it.

I started out with basic and machine language when I was young.

Took a consulting Excel data input job and hated the tedium so I wrote some macros. They were so impressed with the macros that they started paying me 6x more to develop programs for them.

Just after that someone wanted a database program for tracking employee hours--I grabbed a copy of dBase and was able to demo something within a week, fully operational and debugged in a month or so.

Found a job in C--little company willing to take a chance on someone who didn't know the language. Learned it on the fly. Did well enough where I was hired by the customer of a product I had worked on. Once the product was completed, I proposed a simpler version written in VB, they didn't like the "Basic" idea but were willing to let me try (It involved a LOT of screen scraping and string processing, C's worst nightmare).

Learned VB as I coded that. Became a very successful product, and I moved into group where I was able to move the direction of the group towards Java.

More recently I took a pretty big pay cut to work at a company doing web programming so I could more deeply understand the web development world, Ruby on Rails and Agile. (didn't take, by the way, but I'm glad I did it)

Anyway, my point is that to "Learn" a language without using it on a job is mostly pointless. Also, to work where you can just make the most money isn't the "Goal" of life.

Take jobs that make you happy, give you skills and let you do what you want to do. If you don't like programming, become a ski instructor. If you like programming, program!

edit: and for a more direct answer, I find debugging existing code or trying to add a feature to be the best ways to learn a new language. You have example code in front of you and you can look up references on the web. I may pick up a book as a reference if the language doesn't have a tool as powerful as Javadocs, or to teach more advanced techniques at some point.

Bill K
+6  A: 

You did ask how do 'you' go about... Okay, here goes

  1. I sit and fret a month over the fact that I am going to have to learn something new all over again. I lament, I woe and that's even before I've read a single page of documentation.
  2. I read blog posts which are usually too complex for my level and I end up feeling how lousy I am and how awesome everyone else is who understand what they are talking about.
  3. When I have had enough of feeling lousy and the language still hasn't been replaced by something newer/cooler, I dig up some beginner documentation. It still looks complex.
  4. I read the various interpretations, and compare notes between different articles, howtos and help files. I feel that I may be finally be able to write a 'hello world' if I over-exerted.
  5. I am finally able to write a hello world and I immediately wonder why the hell am I doing this when I can write such a natty little hello world in the language that i already know.
  6. I read more documentation/blog/articles/books.
  7. I write snazzier hello world with some fancy dialogs thrown in.
  8. I read more documentation/blog/articles/books.
  9. I think of something that I could actually make in that language.
  10. I read more documentation/blog/articles/books.
  11. I start building that app and am promptly stuck in a million places.
  12. I read more documentation/blog/articles/books.
  13. I ask a n00b question that everyone knows the answer to and make a perfect fool of myself in public.
  14. I read more documentation/blog/articles/books.
  15. I finally know enough code to make the first few pieces of my app.
  16. I read more documentation/blog/articles/books.
  17. I finish my app and see how awesome it is.
  18. I read more documentation/blog/articles/books.
  19. I see how lousy my app actually is.
  20. I feel awesome because now I actually know what lousy is in that language.
  21. I read more documentation/blog/articles/books. ad infitum...

Well, that's how I learn a new language.

Sorry you asked?

Cyril Gupta
In case you think I am trying to be funny. I am not. That's the truth.
Cyril Gupta
Your answer is GREAT. I was looking a step-like approach. Obviously you took it overboard, but it is in a right direction :))))
So I'm not the only one. :)
Nathan Long
+1  A: 

I usually try to understand the syntax and semantics of:

  1. Type system (dynamic typing, static typing, type inference, etc)
  2. Control flow (for loops, if statements, procedure calls)
  3. Console output
  4. Primitives (is it C/Java like with int, double, char, etc? Or perl like with scalars, lists, and hashes?)
  5. Complex data types (How do I make datatypes out of datatypes? structs? classes? algebraic data types?)
  6. Data model (inheritance, garbage collection, pass-by-value or pass-by-reference)
  7. Computation model (strict/lazy, tail recursion, interpreted, compiled, byte-code compiles)

Pretty much in that order, give or take. After that, it depends on what you're using the language for.

One great advantage you can have over other programmers in the field is to know how to read brand new programming languages point-blank. You can do this by learning new languages at a shallow depth to understand why its different from others. (ie lambda expressions, list comprehensions, functions as first-class objects, static and safe typing, etc). Then you know exactly what to look for in another language.

Jeremy Powell
A: 

If you have a good fundamental understanding of programming concepts then picking up a new language should be fairly easy, given you have the time to learn.

Whenever I have had to learn a new technology I first figure out how to do certain things with the new language - how does I/O work? Can it connect to a database? If so, how? How do I define and instantiate an object? How can I include external libraries?

Another good trick is to try to re-write a project in the new language. If you have written a blogging system or something similar, try to rewrite it in your new language.

At this time I am teaching myself Ruby on Rails (coming from a ASP/PHP/J2EE background) and I have found that re-writing small projects in RoR has helped me understanding a lot.

mdinstuhl
+2  A: 

I write a raytracer with a good reference beside me. The basic algorithm is well defined, and they've got everything: file io, user interaction, parsing, image construction, math, complex data structures, implementation of common algorithms, recursion, access to native libraries, threading, optimization, etc. Plus, you use a reference model and you can take one glance at the output and know whether things are functioning correctly.

R Ubben
Dude, you are hardcore.
muusbolla
That is a really good idea. In fact, I'm going to start doing that. Kudos.
Donnie DeBoer
A: 

Personally, I tend to grab a well-recommended book and start building some "Hello World" apps which quickly moves into the realm of "How fast can I build a numbers game or web app with full user authentication?".

Right now I'm working on learning ASP.net 3.5 & C#, so while I wait on being able to afford a good book or two, I'm using some video casts on www.asp.net and found a good MVC project entitled NerdDinner. In the end, all of this (I hope) will have been good experience.

Josh
A: 

I've learned that I can apply my skills of one language on another language. For example one of my friends asked me to help with some Lua and I've never written a line of Lua in my life. I sit down, look at the code and look at the docs. Then I find what I need and write the code, bam, it worked.

Because of this I can virtually use any language in whole world as long as I get the time to understand what I can do and what I can't.

henrikh
A: 

I stare at documentation and try to produce incrementally more complex programs. I've learned that most procedural/imperative languages are essentially the same at the "basic->intermediate" level. Java ~ C ~ C++ ~ C# ~ Perl. Give or take syntax, level of focus, and some quirks. i++ is i++ in any of these languages; a for loop is a for loop.

It's only when you start getting into the mastery of the language that you have to start really running up that heavy learning curve.

Paul Nathan
A: 

When learning anything, I always find the best approach is to use a multi-pronged approach. Using as many different mediums as possible. Mixing action with equal parts book learning (roughly).

Too much action without book knowledge, and you get a lot of code... that stinks. :)

Too much book learning without enough action, and you fail to absorb the material deeply.

And just code everything you can think of.

Alex Baranosky
A: 

To really learn a language well, I find it's best to re-implement it myself from machine code.

Over the weekend.

With my eyes closed.

Nathan Long