I have some free time on my hands and am interested in broadening my horizons. My background is in Python, C/C++ and Java. Does anyone have any recommendations on a new language to learn, and why?

+3  A: 

C# - it's mainstream, complements your other languages, and its very easy to learn if you already know c++/Java.

If you fancy something a bit different then you could try F# or KDB.

+3  A: 

I'd recommend learning something with higher level features: closures, continuations, macros, functional features, etc. There are plenty of options there. Chosing one depends partially on what your goal in learning a new language is. Unfortunately the more of these sort of features a language has, the less mainstream it tends to be.

+20  A: 

Since you've already covered imperative languages, your horizons could be broadened by trying out a pure functional language like Haskell. This will give you some new tricks up your sleeve in addition to an entirely new way of approaching programming.

Ben Hoffstein
Bonus: many functional concepts can easily be used in Python as well!
And C++ too, just not as easily..
Python, Ruby and C++ do not provide the real thing. They feature some aspect of functional programming, but the bulk of their library is still imperative. If you aim to learn fast, better cut these ties !
+4  A: 

Erlang, Haskell, Lisp. Any functional language. Stretch your mind. The future of kilo-core architectures favors functional languages...

Kevin Little
+6  A: 

Haskell, because it deepens your understanding of functional programming and lazy evaluation. After that, you will be able to use the lazy/functional parts of Python much more proficiently.

Torsten Marek
+4  A: 

I think your toolset is missing a functional language, Haskell or OCaml maybe.

Common Lisp is a good one to try too.

Because the best thing you can learn is something totally different than what you currently know and broaden your horizons.

Vinko Vrsalovic
+2  A: 

Learn a web technology like PHP or Javascript - the web is everywhere nowadays, seeping into desktop apps as well. Or if you really want to broaden your horizons learn a functional language like F# or Haskell, as it will require you to unlearn what you have learned about programming.

+1  A: 

Factor, because it's different.

Alternatively, Lisp -- for the same reason.

Generally speaking, pick a language that is as different as possible from what you already know. That's the best way to keep your brain in shape. Furthermore, that's one excellent way to learn new techniques and paradigms.

+7  A: 

I think, you should learn a functional language. Learning new ways of thinking is never a bad thing.

Haskel is a classic language to learn functional programming. But in my opinion it is rather academic (we never got friends). ocaml might also be interesting. It is a functional language, I would like do dive into, if I find the time.

And if you like your Java background, try scala. It is a functional language, designed to run in the JVM. It has many interesting concepts and it is "fun" to use and learn.

So to answer your question: Try learning a functional language to broaden your horizon - Start with Scala - it is easy to get into.

+6  A: 

I would say Ocaml definitely - completely different, full of usable ideas, and is the closest to the mainstream in its camp.

Michael Pliskin
+1  A: 

As a gentler introduction to functional concepts, I suggest Ruby.

I wouldn't entirely disagree, but a small problem is that you can write Ruby in an imperative fashion - it probably wouldn't be good Ruby, but it would work. A purely functional language would force the questioner to try something new.
Daniel James
+9  A: 

Learn Common Lisp. Why? Because there's a really good book published by Apress that you can read for free online.

See Practical Common Lisp

I love this reason of yours ;)
Adeel Ansari
+17  A: 

I recommend that you learn Scheme. I also have a specific book to recommend: The Structure and Interpretation of Computer Programs. [free online edition] It's Computer Science 101, so you'll breeze through it. The authors chose to teach in Scheme because it's so damn easy to learn that you won't even notice you're learning it.

I also recommend the DrScheme IDE. It's part of the PLT Scheme package. PLT Scheme is a mature implementation, with an excellent set of libraries.

Why do I recommend Scheme? Functional programming is mind-expanding stuff: you'll have to let go of some of your old programming skills and learn to embrace the new paradigm, which will make you a better programmer. These skills are especially useful for languages like Perl and ECMAScript which, under the hood, have a lot in common with Scheme.


Javascript - its not 'cool' or 'fun', but the web is everywhere these days, and with the javascript libraries like jQuery or extJS you have something that's capable of building GUIs to repace thick clients. And everyone and his dog wants to replace their legacy thick clients with thin ones.

If you want something to entertain yourself, Haskell or Erlang make good recommendations, but if you wanto something immediately more practical - JS is the one you're missing.

+2  A: 

Definitely LISP. Paul Graham says " Lisp is worth learning for the profound enlightenment experience you will have when you finally get it; that experience will make you a better programmer for the rest of your days, even if you never actually use Lisp itself a lot." His whole talk is at

Scott Bargabus
Paul Graham didn't say that. Eric Raymond did. You are quoting Graham quoting Raymond. :)
You are right, skiphoppy. I stand corrected.
Scott Bargabus
+8  A: 

You've gotten some sage advice from the other posters but I'd suggest a different route: Assembly language. You may never need it professionally but the insight you gain into the workings of the processor and memory management will help you in higher level languages. It's been at least 8 years since I've written,

but I always think about those damn registers when I'm at work (in .net thank God). That and there is something very sexy when it's just you and the processor.

A nice online textbook

Did you know that there's a Haskell extension that lets you put ASM in your code? ;-P
+2  A: 

To broaden your horizons you should learn new programming paradigms. The languages you already know are all object-oriented. Python is supposed to support functional programming, but I don't know python, so I can't say much about it.

You should learn a purely functional language. Examples are scheme, lisp, ML, Haskel.

You may want to learn logical programming (Prolog). It may not have much of a practical value, but it will definitely broaden your horizons.

You should definitely learn some assembly language. Any one would do. x86 would probably be the most accessible. You don't have to become an expert, but once you write a few simple programs in assembly, you will have a much better understanding of what is happening "under the hood" of any program.

You should learn perl. Not because it exemplifies any particular paradigm, but just because it is incredibly useful. It is especially great for little tasks.


You might try a data processing language. Learning XSLT was very rewarding for me, and SQL is always nice, XQuery is coming along nicely.

I upvoted the PHP/Javascript answer, because those are really nice, but I wanted to mention Perl, because it's a great little utility language, much the way Python is.

Although they're not quite languages, you might benefit from learning a language-helper technology. SO's been talking about LINQ to SQL a lot lately, and the other code-generating languages are very useful too. lex/yacc are great, especially for handling any kind of protocol data stream.


I'll suggest Tcl. It is a terrific language to embed within other programs and sooner or later you're going to want to embed some sort of scripting language in your application.

Tcl comes with Tk, and Tk is used by several other dyanmic languages as a GUI toolkit. It provides a remarkably easy way to create cross-platform GUIs which you may need to do some day.

Finally, Tcl is sufficiently different from most languages that it will require you to rethink what you know about software development (as would learning Lisp or Forth and a few others).

Hopefully you'll see a common thread among many of the suggestions in this thread -- pick a language that is sufficiently different from what you know to challenge your thinking.

Bryan Oakley
If you really want a scripting language for embedding in other applications, I suggest you go with Lua instead of Tcl. Lua can be quite beautiful, and is actually on my to-learn list too :)
+2  A: 

Just to buck the trend of suggesting functional languages, I'll suggest Perl. It is far and away the most useful language I know. It's ubiquitous -- just about every Unix-type machine in existence has Perl. And it's easy to get running on Windows too using Cygwin.

I can get more done with Perl in less time than with any other language I've used. This may be equally true of Python and Ruby, I'm not sure. But Perl also has excellent module support. If you need a module that provides a web server, or one to read old FoxPro database files, or to write Excel spreadsheets, Perl has them all. I have never gone looking for a Perl module for any purpose and failed to find one that got the job done.

As for broadening your horizons, learning Perl has helped me with Unix shell scripting, awk, sed, regular expressions, closures, and a lot more.

Of course, Steve Yegge hates it, so perhaps you should try one of those functional languages after all. :)

Python is often a great (should I say "better"?) alternative to Perl, so I don't think Perl will help the poster that much.
@Thomas: Your preference isn't necessarily theirs.Wanted to mention here that ActiveState ActivePerl is a free perl interpreter for windows, that does not require cygwin. All 3rd party perl modules written in perl work as well, that's the vast majority.
And there's Strawberry Perl, which is an alternative to ActivePerl.
Vinko Vrsalovic
+1  A: 

As a bonus, I'll also suggest Smalltalk. I knew C++ and some Java before I learned Smalltalk, so I thought I knew what object-oriented programming was all about. I was wrong. I was using objects to do abstract data types, which is a good start, but I had been doing that already in C. You don't need an object-oriented language for that.

As the only purely object-oriented language that I know, Smalltalk opened my eyes to what object-oriented programming really means. A full explanation would be a long essay, but suffice it to say that until you understand control structures like 'if' as polymorphic calls to methods of the True and False objects, you aren't really doing object-oriented programming.

+2  A: 

I think a functional language would be a great addition to what you've picked up so far. While I think Lisp and OCaml are excellent choices there are very exciting multiprocessing, concurrency, and scalability concepts in Erlang in addition to the functional paradigm.

Mike Steder

Learn SQL. It will expand your horizons and be useful in practice at the same time. I enjoyed "The Guru's Guide to Transact SQL" by Ken Henderson, the last time I tried to refresh on this area.

Steve Steiner
+1  A: 

If you're an object-oriented type of guy, I would suggest looking into Objective-C. Being an object-oriented extension of standard C, it really provides you with a whole new perspective on the design and features of the C++ language. You start to form new opinions on what is good and bad about C++.

Or if you really want a change of scenery.. try a little Prolog ;).



Iulian Şerbănoiu
+1  A: 

It looks like you have the object orientated and scripting languages covered. Why not try a functional programming language like Erlang. It will give you a completely different perspective on writing software. Which will provide you with more ways to solve problems and help you to improve as a developer.


For me Combination of Flex with Ruby makes it really exciting