Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm looking to broaden my development repertoire. Simply, if you had to pick 3-4 languages to learn that offered the most diverse variety in styles and thought processes, what would those languages be?

share|improve this question

closed as not constructive by Aaronaught, Walter, Mark Trapp Jul 2 '11 at 8:20

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

16 Answers 16

This is a very tough call, but I would pick:

a) Haskell : Functional, Strongly Typed, Lazy Evaluation - opens your mind to a lot of things other languages do not.

b) Python : An amazing object oriented, scripting language. Easy to "Get things done". Has now become my language of choice for anything that does not require super speed.

c) C: Teaches one to think close to the machine. Word align your structs, handle your own function pointers, pass around (void *)'s in your generic libraries, and know what writing platform portable code is all about.

d) Lisp: Learn to write code that writes code. Make use of its powerful macro system. Also, learn to program into your problem.

The close miss here would be JavaScript. Very dynamic, very functional, very useful, but knowing these four should make learning JavaScript easy - C syntax, Python like coding style, Lisp like lambda-functions-everywhere.

I really don't think any of the others (save, maybe Ruby) are even worth knowing, except when you are forced to program in that language. C++ C#, and Java, are almost C, with an object oriented paradigm - learning Python well should teach you this.

Prolog is of course very different. But I think knowing Lisp and Haskell should enable you to write your own logic and data driven programs.

P.S. These are the four languages I know and use on a regular basis too. I learnt them (learning them) in the order c), b), a), and d).

share|improve this answer
C and Python are similar in many ways, so I don't think having them both maximizes language breadth. I'd drop one of them and substitute Prolog. Actually, I'd be happier with picking five languages. –  David Thornley Dec 22 '10 at 15:17
@Orbling: I consider the 5GL bit to be hype left over from Japan's grandiose plan to dominate computing (and we all know how successful that was, or can guess if we never heard of it before). It's a weird language, but with no fundamental superiority over Lisp or C++. –  David Thornley Dec 22 '10 at 15:21
Calling C++: "almost C, with an object oriented paradigm" is quite inaccurate, to put it mildly. If nothing else, it completely ignores generic programming. Paradoxically, C++ is compatible with C, but well written C++ isn't much more like C than Lisp or Prolog is. –  Jerry Coffin May 2 '11 at 17:38

Haskell / C++ / LISP / Perl

... may Gawd help you with this one ...

share|improve this answer
+1 Much what I would advise, all essentials. C++ over Java possibly covers more bases, sitting in between hard-OOP, high-level and more traditionally imperative and low-level styles. –  Orbling Dec 21 '10 at 1:34
@Orbling - My thoughts exactly (on C++/Java). Someone will also probably replace Perl with Python in its field; I take that more of a personal preference, when it comes to that choice. –  Rook Dec 21 '10 at 1:40
I considered that others would pick Ruby, Python (or even PHP) in that class - they are great, but are so by being closer to the OOP and functional languages and features. I wanted it to be further away. I nearly dropped Perl in favour of bash. –  Orbling Dec 21 '10 at 1:45
Haha. +1 for your bonus comment. Just because its very true -edit- i also agree on those 4. –  acidzombie24 Dec 22 '10 at 4:04

Some really good answers so far. I'd highly recommend checking out the book "Seven Languages in Seven Weeks" by Bruce Tate from Pragmatic Programmers. He goes through 7 different languages (Ruby, Io, Prolog, Clojure, Erlang, Haskell and Scala). I've been working through it myself and it gives a great intro to each language and gives you a chance to explore different programming paradigms between OO, Prototype, Declarative, Functional and a couple hybrids.

share|improve this answer
+1: It's on my xmas list (and I heard my wife on the phone with the book store while I was 'asleep' this morning, looking for it :) ) –  Steve Evers Dec 21 '10 at 3:44
+1 Sounds great, something everyone (well coders that is) should do I think. –  Orbling Dec 21 '10 at 13:39
@Orbling: Eavesdrop on their wives? :) –  Mladen Jablanović Dec 22 '10 at 13:56

A hard call, but my personal selection would be:

  1. Functional: Haskell
  2. OOP: Java
  3. Script: Perl
  4. Logic: Prolog

The choices within the categories are because they offer the most distinctive experience of the styles given within their class. Not because they are best in their class, just furthest in to them for experience purposes.

I would also recommend a Lisp/Scheme, and an assembler of some sorts.

share|improve this answer
These choices are pretty similar to what I'd pick. Perhaps C# instead of Java, say what you will but it does seem to be "Java without the clunky bits". I'd also recommend giving straight C a try, perhaps as a segue into your assembly of choice. –  Anon. Dec 21 '10 at 1:35
Does SQL count as a language? It's definitely a completely different mindset. –  Benjol Dec 21 '10 at 9:10
"OOP: Java" << Really?!?!? –  missingfaktor Dec 22 '10 at 4:00
@Orbling: I am not sure why you would show someone a language that wouldn't truly expose them to OO in order to expose them to OO. An analogy: If I want to show you what rum tastes like, I can either give you a glass of rum and coke and let you work out what part of the flavour is rum and what part is coke, or I can just give you a shot of straight rum. –  doppelgreener Dec 22 '10 at 13:47
@back2dos: Who says what's true OOP? –  David Thornley Dec 22 '10 at 15:15
  1. C: because that's how machines work.
  2. Python (or maybe Ruby, or even Perl): dynamic scripting languages, immensely practical.
  3. JavaScript: how a great design can be atrociously implemented and still succeed.
  4. LISP or Lua: unmatched elegance, rediscover the joy of creating things of beauty.

hum... I've left out any static, class-based, OOP like Java, C++ or C#... It's an important category; but I'd gladly trade it for any of the mentioned. Well, not exactly, I really hate JavaScript and really like C++; but the hard lessons of the mistakes in the history of JS are really valuable.

share|improve this answer
That's funny, I really like JavaScript and hate C++, LOL. Good list, particularly your justifications. –  Orbling Dec 21 '10 at 2:58
Bits are how machines work. You could argue assembly language. C is definately NOT how machines work. –  Cameron MacFarland Dec 21 '10 at 3:57
C is nothing like how machines work. You want to see how machines work, learn an assembler. Any assembler (or, preferably, two: one CISC, one RISC). C abstracts away too much important stuff to get any real idea of how a machine works. –  JUST MY correct OPINION May 1 '11 at 11:31

I would choose Assembly Language, Haskell and Prolog for the reasons already stated and add Eiffel (great OO language) and SQL (if that counts as a programming language).

share|improve this answer

I will go reading this book: Seven Languages in Seven Weeks, and then I will see which 3 or 4 languages from those I want to learn better :).

share|improve this answer

Erlang (or Lisp)
Python (JavaScript or ActionScript (prototypal inheritance))
C (or assembly)
Objective C

share|improve this answer

This is a problem, but I'm going to jump on the OP's comment about broadening experience, and assume that the OP is familiar with mainstream-style programming languages already (with C-style syntax and OO). Also, I'm only going to include languages I've been exposed to (which leaves out the excellent concurrent language suggestions).

Common Lisp is a surprisingly useful language. The fact that programs are written in parse-tree format allows a great deal of flexibility. Make sure you learn to use macros, which are nothing like C-style macros.

Haskell is good for pure functionality and a strict type system.

Prolog is a decent language, and a different paradigm. (Personally, I don't like it, but I certainly didn't waste the time I spent learning it.)

Forth is an unusual programming language, fun to play with and instructive in how a language can be built.

There are other languages I'd like to list, had I room and experience with them. Smalltalk and Erlang sound like excellent choices, but I've never done anything with either of them. Tcl is unusual, although I hated the way it made my brain feel. Assembler is good for giving a feel as to what a computer is really doing, although I hate x86 for its layered-on complexity and would prefer to use another processor, if only in simulation (the ones I've used were IBM 370, Control Data 6x00 and follow-ons, Z80, Knuth's MIX, 6809, and a little 68000).

share|improve this answer

Here's my take, drawn from experience of things that have progressively 'stretched' (if not blown) my mind.

  • Assembly - close to the metal
  • SQL - so totally not like anything else I'd used
  • F# - or anything functional. Again, a paradigm shift
  • C++/Java/C# - anything in the OOP field. I'd give this one less importance only because it's what most developers already have some experience in anyway.
  • Something 'webby' - this isn't so much about language, but getting your head round 'what happens on the server and what happens on the client'.
  • I'd quite like to try Erlang, as it seems like yet another way of thinking your code.

That's not 3-4, sorry :)

share|improve this answer
  • Assembly Language - makes it easy to reason about computer architecture.
  • C - Low level language that gives you much control of memory and hardware. A good fit for writing a Operating System.
  • Java - Object oriented language that runs on multiple platforms without recompilations.
  • Erlang - Concurrent language where you can create millions of "processes" on your machine, and easyli scale out to a hole cluster. Do concurrent without threads and shared memory - with asynchronous message passing. See Erlang - software for a concurrent world
  • F# - Functional programming in a static typed language with type inference.
share|improve this answer
+1: Good suggestions. I struggled between F# and Haskell for a functional language. I love that F# makes the .NET framework available, but find that, because of that, it's too close (in proximity) to what I already know. –  Steve Evers Dec 22 '10 at 16:49

I'd vote for:

  • A OO "C family" language - one of C++, C# or Java. If you can read one of these you can pick up just about any book on software development and follow the sample code.
  • A common web scripting language - i.e. Javascript, because this is so common you can hardly avoid it.
  • A "trendy" dynamicly typed language, maybe Python (Google use it a lot if that makes any difference). Not because they are trendy but because dynamic typing is very different to the alternative.
  • A functional language - F# if you are a .Net person or Haskell if not. Functional programming is not just a fresh way of writing code but I think it can help in the "day job" (especially if your day job is C#).
share|improve this answer
  1. Learn two assemblers: one CISC (e.g. x86) and one RISC (e.g. MIPS). Rationale: you will truly understand what's going on under the covers of your machine just shy of having to know voltage levels.

  2. Learn a "systems language" -- a no-frills procedural language like C or Modula-2 or the like. Rationale: Here you'll be able to make more useful software while still being aware of some of the issues of underlying hardware.

  3. Learn an object-oriented language: one of Smalltalk (pure OOP, dynamic), Java (semi-pure OOP, static) or Eiffel (pure OOP, static). Rationale: OOP is the Kool-Aid of choice in modern computing so you might as well drink some off the start.

  4. Learn a functional language: one of Haskell, one of the MLs (F# counts) or Erlang. Haskell is the purest functional and is also very statically typed. The MLs are not quite as pure but still pretty damned pure and are also very statically typed. Erlang is nowhere near as pure, but it is pure enough to grok the concepts and it has the added benefit of teaching you a radically different way from the usual of thinking about concurrency. Rationale: I think functional is turning into the next Kool-Aid of choice as OOP's flaws become more and more apparent. Drink it now to be hip and trendy.

  5. Learn a logic language, most typically Prolog. Rationale: Logic programming will radically change the way you see what programming even is. It never hurts to think in new ways about old problems.

That's five languages, unfortunately, so I've broken your 3-4 level without even having touched on learning a Lisp or a Forth to get extreme flexibility, homoiconity, etc. from two radically different directions (extreme high-level and extreme low-level respectively). You may want to boost your number a bit there. ;)

share|improve this answer

If forced to limit myself to four, I'd go for:

  • Assembler: because it is really useful to know what all code ultimately gets translated into and it helps you understand the machine much better. Also, it's a classic example of an imperative language.
  • Java - Java gets a lot of abuse - some of it fair, most of it unwarranted. But it should be on the list because it's the classic, statically typed, garbage-collected object-oriented language. Also its very significant commercially so great to have on your resume / CV. C# would also be a similar option here, but I prefer the portable Java/Open Source mentality to the Microsoft closed shop.
  • Prolog - because logic programming is significantly different from other paradigms, and it's therefore a great way to broaden your horizons.
  • Clojure - IMO the best modern Lisp, it's an extremely powerful and productive dynamic language that provides excellent support for functional programming and concurrency in particular. Also everyone should get a taste of Lisp-style macro meta-programming at some point, if only to marvel at the wonder of writing programs that write programs that write programs that...

Other options that would be very close to making the top 4 list:

  • Haskell - notable for its exceptionally pure functional approach (would be in my top 4 if not for Clojure, which I think is a somewhat more pragmatic functional language)
  • Javascript - actually a very nice language with a lot of nifty features - will teach you a lot about dynamic, prototype-based object orientated systems
  • C++ - because it's a "system level" language for writing robust, high performance code close to the metal while still enjoying some powerful abstractions.
share|improve this answer

Smalltalk: true object oriented.
Haskell: pure functional language.
Lisp: create what ever you want.
Prolog: Logic programming.
I would like to add: Io language.

share|improve this answer

C - pretty assembly

LISP - lambdas, recursion

Ruby - scripting, metaprogramming

Haskell - mathematics

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.