If you could only learn three programming languages, which would you choose?
spreadsheets.google.com
spreadsheets.google.com
C needs to be one of them, because everyone writes their libraries in C, and you need to use them and be able to contribute your own libraries. Don't use C for applications, though; there is no performance gain (gluing C libraries together in C is as fast in $foo as it is in C for most values of $foo), and there is a maintainability and expressiveness loss. Libraries are simple enough and small enough in scope that this doesn't matter. Your HR org-chart editor web app? Not so much.
So I use C for libraries that other people need to use, but nothing else. This way, I get code reuse without having to force a "policy decision". Everyone is fine with C and it integrates well with pretty much every other programming language.
After C, you need a language for high-performance but moderately complex applications. This language needs to allow for expressive description of high-level tasks, but it also needs to expose primitives for writing "fast" code. A lot of people choose C++ for this, but I think C++ is a bit too low-level for application development. Most people choose Java or C#. (I hate both, but it's close to the right thing.) I use Haskell; other good options are OCaml, F#, Common Lisp, etc.
I use this class of languages for things like ETL or network-based computation services. The code is a little complex, and it needs to run fast. This family is perfect for that.
The third language you need to know is a "scripting language". This is a loaded term, because scripting sounds like it's not real programming. But this is wrong, making a Perl script to filter your email is just as "real programming" as writing the TCP stack for your OS. If you have a problem you want to solve and you type some stuff into a computer so that it learns how to solve the problem, that's programming.
I use Perl, but obviously there are a lot of options here; Perl, Python, and Ruby are the best choices, followed by Lua, various Scheme implementations, and so on. I picked Perl over Python and Ruby because they all really suck performance-wise, but at least Perl has a great community and a great library repository. It doesn't really matter which you choose, as long as you love it. (My favorite color is green. Yours may not be. Let's not argue about it, though.)
This class of languages, in general, is best for building complex applications where maintainability is the core requirement. Scripting languages give you the tools to design and build incredibly flexible abstractions that let you hide a lot of complexity where appropriate. They also make it really easy to write great tests, and to implement new ideas. Being unafraid to refactor your code and being able to design abstractions to refactor into are the keys to maintainability. And languages like Perl make that really easy.
Lately I've been playing with node.js, which I really like for "quick scripts" that need to be event-driven and need to talk to the network. I'm hesitant to include it in this category, though, because it lacks good namespace support, which makes writing complex apps tough. It also doesn't have a mature toolchain yet. But it is cool and if you have done web programming but haven't done any "scripting", you can get started and start having fun quickly. So do check it out.
(Also worth noting; I've written event-based network services in all three classes of languages. The performance is the same regardless of which you choose! Nothing is slow for IO; the plumbing is all handled in some generic C library and the OS. C is fast, Haskell is fast, Perl is fast, and node is fast.)
Finally, if you do web stuff, you need a fourth language that compiles to Javascript, just because that's how the web works. I think plain Javascript is fine, so I use that, but coffeescript and friends are also cool.
I recently learned that Lua is pretty fast, according to anecdote and shoot-out data. I did not like the syntax, when I last looked at it. But I might change my might. I mostly use Python for this class of things at the moment. Though I could see myself use Haskell more.
We use OCaml at work for your first and second category. (We do interface with C, too.)
I prefer Lua to all of those, but that again is a matter of taste.
And yes, Lua is pretty fast, and LuaJIT (http://luajit.org/) is so fast that it's a major outlier among scripting languages.
We had a poll for that (http://news.ycombinator.com/item?id=1983229 ), but it diverged a bit into answering "which ELSE three programming languages would you learn" and natural languages discussion.
EDIT: If you choose "Other" from the list, could you please add a comment here saying which language would it be?
EDIT2: live results: https://spreadsheets.google.com/ccc?key=0AgDNp1TM4umedC0zRkR...
I'll sum it up and post the results later.
C/Pascal/Delphi are not so different from each other. C++/Java/C# are not so different from each other. PHP/Python/Ruby/Perl/Lua/JavaScript/Shell are not so different from each other. Arc/Scheme are not so different from each other.
You've neglected the APL family of languages. You've neglected the Prolog family of languages. You've neglected the Forth family of languages. You've neglected languages in the family of theorem provers, such as Coq, Agda and ATS.
You've also made some other strange choices. Scala and OCaml but not Standard ML? Smalltalk and C++ but not Simula? Groovy, which nobody will remember in three years, but not Fortran, a timeless classic still in wide use today?
Okay, so SQL isn't a general-purpose programming language. It's not Turing complete, either. But I wouldn't go so far to say it's not a programming language. It's a domain-specific language used for programming. I believe that makes it a programming language. Not one I like too much, but a programming language nevertheless.
As for languages selection - I considered adding assembly, F#, ML, Fortran, Algol and some others, but I had to stop somewhere. I combined the options in DZone with GitHub top, and added a few other names.
SQL was explicitly requested in the previous discussion, so I added it. Groovy scored above Lisp and ObjC in DZone's survey, so it's in the poll as well.
Sure it is:
http://wiki.postgresql.org/wiki/Mandelbrot_set
http://assets.en.oreilly.com/1/event/27/High%20Performance%2...
- you need to know C. All your infrastructure and fundamental libraries are built in C. If you can't read the code or fix bugs in your infrastructure, you need to hire somebody else who can. (N.B. if you work in an environment where all your infrastructure is in Java, you need to learn Java instead. If you work in an environment where all your infrastructure is Microsoft, you're screwed because that's not open source).
- you need to know Javascript. It's running on all of your client's desktops.
- you need to know a glue language. Probably sh, but Perl works too. Python and Ruby are alternatives, better in some ways, worse in others.
Those are the three you need to do your job. But if that's all you know, you're not doing a good one. For instance, the best way to become a good Javascript programmer is to learn Lisp.
You need to know javascript. There are a lot of industries where you can live without it. It certainly doesn't make it onto my top three.
So you might be able to get away without knowing Javascript, but you'll need somebody in your company who does, so my original comment stands.
For example, to have a better understanding of programming I would chose 3 different paradigms: - an object oriented language. eg: Smalltalk - a logic language. eg: Prolog - a functional language. eg: Haskell
But if I would want to get a good job I would chose Java, C# and Objective-C
Which is strange. In most other endeavors you'd think being fluent in three similar ways of doing something would be enough.
FWIW, I'd choose Lisp, Javascript, and C. But I'd be writing an assembler as my first project and a database interaction language as my next. And now that I think about it, my database language would look nothing like SQL...
Anecdotally, I don't personally know anybody using Ruby that isn't at least primarily a web developer, either, but I know several Python users.
In my opinion:
i) C#: It's the most advanced general purpose programming language. ii) Python: Excelent scripting and glue. iii) Javascript: It's the Web!
But for system programming...: i) Assembler ii) C++ iii) Python. It's good for Reverse Engineering too!
However, Arc and Haskell are fun to learn.. and you also need some C/C++/Java/C# background otherwise you're not serious right? Then, with this knowledge, it'd be a bit weird not to know Ruby and Perl. And some bash/sed/awk is required to work on a unix box.
Damn, I hate those pick "three programming language" questions.
I program in three languages on most days (though not the same three all the time). These artificial constraints are difficult.
For others who answered C->Python->Javascript, what were your reasons?
I am a hobbyist, so I am free to discard anything, that The Man wants to see in a resume. Hence I've never really got into Java (a nice language, turned into the Cobol of our generation -- to all people writting Enterprise: Java's blood is on YOUR hands!) or C++ (if C is a scalpel, then C++ is a chainsaw... while you're drunk... with someone preaching protected attributes and virtual destructors in Fran Drescher's voice).
But C has inherent beauty to it, expressed in terse verses of absolute and utter control.
Python structures my thoughts.
And Lisp is all that is and ever will be.
Amen.
As for arc-arc-arc answers - one out of 62 so far.
EDIT: I answered to the previous version of the parent.
Btw, how do I see the current tally?
How come? As far as I can see, JS would be one of the top answers.
Well, that's what "Other" is for.
I'll sum it all up and post the results some time later.
you can do everything.