Re:If you could only learn three programming languages, whic...
by jrockway on Thursday December 09, 2010 @09:22AM
(#1987497)
Three is a good number.
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.
Re:If you could only learn three programming languages, whic...
by eru on Thursday December 09, 2010 @09:33AM
(#1987526)
> 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.
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.)
Re:If you could only learn three programming languages, whic...
by silentbicycle on Thursday December 09, 2010 @11:15AM
(#1987937)
Lua's other strong point here is that it has an especially nice C API. Unlike Perl, Python, and Ruby, it was written primarily to script C, with use as a standalone language being secondary.
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?
Re:If you could only learn three programming languages, whic...
by tumult on Thursday December 09, 2010 @06:16AM
(#1987004)
You've included many redundant languages while simultaneously excluding several classes of languages. Many of your other decisions seem odd.
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?
Re:If you could only learn three programming languages, whic...
by CodeMage on Thursday December 09, 2010 @06:24AM
(#1987018)
And SQL isn't a programming language.
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.
Re:If you could only learn three programming languages, whic...
by egor83 on Thursday December 09, 2010 @06:28AM
(#1987030)
I agree with some of your points, though I don't think making C/Pascal and Python/PHP groups would be a good decision.
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.
Re:If you could only learn three programming languages, whic...
by jamii on Thursday December 09, 2010 @05:52AM
(#1986944)
I'm starting to get annoyed with the way google translates pages based on my ip and then offers to translate them back based on my browser settings. This is sub-optimal.
Re:If you could only learn three programming languages, whic...
by bryanlarsen on Thursday December 09, 2010 @01:03PM
(#1988363)
Three is a bad number. Three is the minimum required to do your job, so doesn't let you choose any cool languages that blow your mind and make you a better programmer.
- 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.
Re:If you could only learn three programming languages, whic...
by bryanlarsen on Friday December 10, 2010 @03:37PM
(#1993083)
Name one. I'm willing to bet you've got your head in the sand. I work in the embedded industry. A significant minority of these devices are shipping with web servers on board for command & control. The price difference between an 8 and 32 bit micro is dropping quickly.
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.
Re:If you could only learn three programming languages, whic...
by rquesada on Thursday December 09, 2010 @08:58AM
(#1987407)
The question needs more context, like"
"if you could only... to get a good job"
"if you could only... to understand the roots of programming"
etc..
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
Re:If you could only learn three programming languages, whic...
by drblast on Thursday December 09, 2010 @08:57AM
(#1987401)
Well, if this proves anything, it proves that not even three languages cover every problem.
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...
Re:If you could only learn three programming languages, whic...
by duck on Thursday December 09, 2010 @09:08AM
(#1987439)
Each time one of these "surveys" comes up I am surprised by the number of Python vs Ruby responses. It seems to always be 3 to 1 in favor of Python while I had thought the usage was more like 50/50.
Re:If you could only learn three programming languages, whic...
by Symmetry on Thursday December 09, 2010 @09:26AM
(#1987508)
Are you involved in web development? It probably is about equal there, but where I work we have a substantial contingent of people who use Python on top of C or C++ for hardware control or who have switched from Matlab to Python, but I don't think I know a single Ruby user.
Re:If you could only learn three programming languages, whic...
by wslh on Thursday December 09, 2010 @07:15AM
(#1987111)
First it's important to note that the importance of programming languages is time sensitive, it depends of current programming language maturity and their related tools: VB was a success mainly because the IDE gave a lot of power to [below] average developers.
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!
Re:If you could only learn three programming languages, whic...
by tzs on Thursday December 09, 2010 @06:32AM
(#1987039)
It's a bit unclear. Is it assuming I'm starting from knowing no programming languages, or is it asking which three programming languages I would learn in addition to the ones I already know?
Re:If you could only learn three programming languages, whic...
by d0m on Thursday December 09, 2010 @07:52AM
(#1987195)
Scheme/Python/Javascript (Mainly to be able to do a little bit of everything - and scheme to make you learn to think out of the box)
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.
Re:If you could only learn three programming languages, whic...
by dqh on Thursday December 09, 2010 @06:46AM
(#1987069)
I was intrigued that my answers for 1,2 & 3 are the most popular. I answered 1:C for simplicity and an an appreciation for where we've come from. 2:Python because i've never felt as free to express as when using python. 3:Javascript because it's practical to learn it.
For others who answered C->Python->Javascript, what were your reasons?
Re:If you could only learn three programming languages, whic...
by portmanteaufu on Thursday December 09, 2010 @09:49AM
(#1987601)
I answered Python->C->Javascript, but I'll pretend I was invited anyway. :) Python because I enjoy it the most -- if I had to be stuck with a single language, Python would be it. Even if it doesn't run the fastest, its library set and readable syntax make it very endearing to me. I picked C next because it's the obvious choice for speed and systems programming. The fact that you can write libraries for use in many other languages in C is also very appealing. Finally, knowing Javascript lets you contribute to the web. It's a great scripting language that I think gets a lot of flack from people that had to use it in the days before great toolkits like jQuery. While I'd like a choice in front-end scripting languages as much as the next guy, I've come to appreciate JS for what it is.
Re:If you could only learn three programming languages, whic...
by kokoito on Thursday December 09, 2010 @10:09AM
(#1987679)
I've chosen C, Python and Lisp: because those aren't languages, but mindsets, that allow freedom of thought and expression.
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.
Re:If you could only learn three programming languages, whic...
by derefr on Thursday December 09, 2010 @06:02AM
(#1986977)
Are programming languages really discrete, though? If you learn Scheme, then write Arc in it, do you now know Arc, or do you still just know Scheme? If you Greenspun in C, do you still only know C, or did you "learn" (half of) Common Lisp?
Re:If you could only learn three programming languages, whic...
by keefe on Thursday December 09, 2010 @07:04PM
(#1989882)
so here I have a great IDE, lots of static analysis, continuous integration, automatic dependency management etc... people who say you can't maintain java don't know how to code in it, after 13 years it's clear to me why it's still popular.
Re:If you could only learn three programming languages, whic...
by rednum on Thursday December 09, 2010 @09:10AM
(#1987448)
Actually I don't think you can do everything in those 3 languages, you should try some functional programming and see the difference by yourself. Sure, all languages are turing equivalent, but some of things that are easy to write in e.g. lisp would be really painful to do in c++/java. Also none of them is suitable for replacing e.g. bash as a scripting language.
Re:If you could only learn three programming languages, whic...
by keefe on Thursday December 09, 2010 @07:06PM
(#1989888)
give me one example of something I can't do.
of course I've done functional programming and sometimes it's nice, but I don't see it as the big advantage many people do.
Algorithms and engineering are sometimes hard, actually programming is rarely the difficulty in any project.
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?
Sure it is:
http://wiki.postgresql.org/wiki/Mandelbrot_set
http://assets.en.oreilly.com/1/event/27/High%20Performance%2...
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.
- 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.