In all the substantial programming projects I’ve undertaken, what I think of the language itself has never been a consideration.
One of these projects needed to run (client-side) in any web browser, so (at that time) it had to be written in Java.
Another project had to run an a library embedded in software developed by other people and also standalone at the command line. I wrote it in C++ (after an ill-considered first attempt to write it in Perl), mainly because it was a language I knew and performance was an essential requirement, ruling out Java (at that time).
My current employment is developing a tool for biologists to use; they all use Matlab, so it’s written in Matlab, a language for which I even have a file somewhere called “Reasons I hate Matlab”.
If I want to write an app to run on OSX or iOS, the choices are limited to what Apple supports, which as far as I know is Objective C, C++, or (very recently) Swift.
For quick pieces of text processing I use Perl, because that happens to be the language I know that’s most suited to doing that. I’m sure Python would do just as well, but knowing Perl, I don’t need Python, and I don’t care about the Perl/Python wars.
A curious thing is that while I’ve been familiar with functional languages and their mathematical basis for at least 35 years, I’ve never had occasion to write anything but toy programs in any of them.
The question I always ask myself about a whizzy new language is, “Can this be used to write an interactive app for [pick your intended platform] and have it be indistinguishable in look and feel from any app written in whatever the usual language is for that platform?” Unless the answer is yes, I won’t take much interest.
A programming language, properly considered, is a medium for thinking about computation. I might be a better programmer for knowing the functional or the object-oriented ways of thinking about computation, but in the end I have to express my thoughts in a language that is available in the practical context.
Can this be used to write an interactive app for [pick your intended platform] and have it be indistinguishable in look and feel from any app written in whatever the usual language is for that platform?
Now that my platform is the web the answer is “yes” for nearly every language, which is awfully freeing.
I don’t know that I have a “favorite” programming language.
What I use for getting everyday things done: Python, with a bit of shellscript for the really quick things. Why? Because I know it well. I learned Python years ago because it had libraries I needed, kept using it because it got the job done, and then worked for many years at an employer where it was one of the Officially Approved Languages.
What I mess around with, when I’m messing around with code recreationally: currently Elm. Why? Because functional reactive programming is a freaking awesome idea, and Elm makes it actually make sense. Also, whereas Python supports antigravity out of the box, Elm supports time travel.
What I would use if I needed to write code that would run fast and handle user traffic: Go. Why? Because it is efficient, safe (from buffer overflows and the like), and makes concurrency really easy. There’s not really any such thing as high-performance code without concurrency these days. Safety matters a lot, too — the last project I wrote in Go was an SSH honeypot to log the usernames and passwords that attackers try. It helps that Go code is clear enough that I could actually read enough of the crypto libraries to have confidence that I wasn’t going to regret it.
Other languages I like for one reason or another: Haskell and Lisp, for expressing two deeply contrary ideals on what programming is.
What we’ve got from this question so far is some specific comments on merits and demerits of a bunch of languages. A poll wouldn’t (necessarily) have given that. And so far there’s not a lot of language-warring.
I agree that a more focused question might well meet AspiringRationalist’s goals better, but as far as general discussion goes I don’t see that the question s/he actually asked has done much harm.
Python for casual stuff—it’s powerful, the code doesn’t become incomprehensible 6 months (or 6 hours) after writing it, and the design is coherent enough that returning to it after a short period of disuse doesn’t involve too much painful swapping everything back into memory. Main downside: the usual Python implementation is really slow. (For some categories of calculation-intensive task, Numpy mitigates this. It’s not too hard to extend Python in C or C++. There’s an implementation of Python called PyPy that runs some code much faster, but is much more memory-hungry.)
I tend to say that Common Lisp is my overall favourite programming language, but I’ve written hardly any in the last decade or so. Admittedly that’s mostly because in the last decade or so most of my programming has been done at work where language choice is usually determined by factors other than my general preferences. CL’s pretty nice, though: it has roughly the usual set of useful datatypes found in modern languages, is highly extensible both syntactically and semantically (via “reader macros” and ordinary macros; C users should note that CL’s macros are not at all like C’s), has a reasonably capable standard library, and can be made to run pretty fast despite being dynamically typed. Downsides: the syntax is a bit clunky in some respects (e.g., there are hash-tables but no literal syntax for making them), some kinds of genericity we’re used to nowadays—e.g., being able to use the same code to do standard things to anything that “behaves like a sequence”—aren’t there, and because it’s not a popular language nowadays there’s much less chance that someone’s already solved 90% of your problem than there is in, say, Python or Ruby or even C++.
I retain a soft spot for good ol’ C, but reluctantly concede that these days you generally want to be using C++ rather than C for really performance-critical work. But C++ is a very unlovable language. (Recent versions have made a lot of things nicer, if you do things the “modern” way—but most of the C++ code I deal with day to day has to run on very resource-limited embedded processors, which means we generally avoid a lot of the standard library, and has to be able to build with old compilers, which means a lot of those nicer friendlier features might as well not be there.) I have hopes that Rust may turn out to be a “better C++” but it’s early days yet.
On the thankfully rare occasions when I need to write something Windows-GUI-ish, C# is actually a pretty good tool these days. In particular, LINQ is pretty cool (comparable to Python’s comprehensions but uglier and more capable).
I still use Perl for exactly one purpose: one-liners in the shell for tasks just one notch up from what a single grep invocation will do.
For numeric stuff I regrettably tend to use MATLAB (which was well established at my current employer well before I got here). Python/Numpy would be a pretty good alternative—as a programming language MATLAB is maybe one step above INTERCAL—but isn’t so convenient for interactive use, which is quite a big deal.
Things I have a constant sense of nagging guilt for not having looked at properly yet: Julia (might make a really good replacement for MATLAB/Python+Numpy), Haskell (clearly very powerful and elegant, and lots of language-theoretical stuff happens there), Go (clearly not in any way an interesting language, but for its niche—pretty much anything you could call a “server”—it seems well designed), Racket (seems like they’ve grown Scheme into something really capable, and maybe it should be taking CL’s place in my heart).
For numeric stuff I regrettably tend to use MATLAB (which was well established at my current employer well before I got here). Python/Numpy would be a pretty good alternative—as a programming language MATLAB is maybe one step above INTERCAL—but isn’t so convenient for interactive use, which is quite a big deal.
Doesn’t ipython solve a lot of the issues of convenience for interactive use?
Yes, ipython is nice and plays well with matplotlib. But there are some things MATLAB still does a lot better. For instance: make a 3d plot and move your point of view around with the mouse. Trivial in MATLAB, impossible in ipython/matplotlib.
Mostly “functional”-style, in the sense of having algebraic data types and expressions as the chief syntactic construct, but with this system of subtyping and objects for the things like modules and closure types that actually need the existential type. I ended up writing my own type-inference algorithm, which I’m still formalizing in Coq now.
I prefer to use Ruby when possible, though I switch to Python (with numpy) for more math-heavy applications. Ruby’s ability to chain methods, syntactic sugar, and larger amount of built-in methods makes programming much more fun and efficient than Python, where I’m constantly going back a word to write a new method and enclose what I just wrote in parentheses, or counting parentheses/brackets, which I don’t really seem to need to do in Ruby. Python is still much more enjoyable to program in than most other languages, but compared to Ruby, it feels like programming backwards. I also prefer to use Ruby/Rails for prototyping and web development.
Scala (for large server-side programs). Static types and functional programming, with access to the Java ecosystem/libraries. Some of the more advanced type system features are too complex/abstract for my taste and the most popular build system, SBT, is horrific.
Ruby (for quick scripts) . I have a slight aesthetic preference for it over Python but Python would probably be just as good.
Tolerate:
Java. Kind of a lesser Scala but with very solid tool and framework support. Java 8 adds some decent functional features but it can still be pretty clunky and verbose.
C#. Similar to Java (though I have little experience with it).
Dislike (based on little experience):
C++. Too many arcane rules, too easy to screw up.
Perl. Like Ruby or Python but with syntax that is much more complex and idiosyncratic for seemingly no benefit.
Mixed:
Clojure. Some great features but I dislike dynamic typing for large projects and also dislike the Lisp syntax.
Javascript. Appreciate the simplicity of the core “good parts” but is dynamically typed and I don’t like the prototype-based object system.
Interested in:
Rust. Seems like it could be a nicer language for the cases where C++ is warranted. Waiting for 1.0 to come out before trying.
if customer.dictates('specific language')
use('specific language') # usually Java / PLSQL / .Net
else
use('Python')
except error('too slow')
use('C')
I love the simplicity and power of Python and will use it to prototype proof of concepts (not so much GUI work—would use HTML or .NET for that).
For me, Python really makes programming a lot of fun again and though it is slower, I haven’t yet had the need to shell out to C code though I expect I will soon.
I’m currently developing Autocad extensions, so I work routinely in AutoLisp, but pure Lisp implementations are at best outdated. So I was very interested when Clojure came out. Now that I’m tackling video-games with HTML5/CSS/JavaScript, ClojureScript might become a very interesting alternative.
I was also very fascinated by Scheme’s call-with-current-continuations, so I’m hoping they will implement in Clojure.
I’ve read that call/cc can be emulated with continuation monad, and monads might just be parte of the next core… I’ve yet to dig into the issue, though.
What are people here’s favorite programming languages, for what application, and why?
In all the substantial programming projects I’ve undertaken, what I think of the language itself has never been a consideration.
One of these projects needed to run (client-side) in any web browser, so (at that time) it had to be written in Java.
Another project had to run an a library embedded in software developed by other people and also standalone at the command line. I wrote it in C++ (after an ill-considered first attempt to write it in Perl), mainly because it was a language I knew and performance was an essential requirement, ruling out Java (at that time).
My current employment is developing a tool for biologists to use; they all use Matlab, so it’s written in Matlab, a language for which I even have a file somewhere called “Reasons I hate Matlab”.
If I want to write an app to run on OSX or iOS, the choices are limited to what Apple supports, which as far as I know is Objective C, C++, or (very recently) Swift.
For quick pieces of text processing I use Perl, because that happens to be the language I know that’s most suited to doing that. I’m sure Python would do just as well, but knowing Perl, I don’t need Python, and I don’t care about the Perl/Python wars.
A curious thing is that while I’ve been familiar with functional languages and their mathematical basis for at least 35 years, I’ve never had occasion to write anything but toy programs in any of them.
The question I always ask myself about a whizzy new language is, “Can this be used to write an interactive app for [pick your intended platform] and have it be indistinguishable in look and feel from any app written in whatever the usual language is for that platform?” Unless the answer is yes, I won’t take much interest.
A programming language, properly considered, is a medium for thinking about computation. I might be a better programmer for knowing the functional or the object-oriented ways of thinking about computation, but in the end I have to express my thoughts in a language that is available in the practical context.
You might enjoy (if that’s the right word) the Abandon MATLAB blog. (Which, in a slight irony, itself appears to have been abandoned.)
Now that my platform is the web the answer is “yes” for nearly every language, which is awfully freeing.
I don’t know that I have a “favorite” programming language.
What I use for getting everyday things done: Python, with a bit of shellscript for the really quick things. Why? Because I know it well. I learned Python years ago because it had libraries I needed, kept using it because it got the job done, and then worked for many years at an employer where it was one of the Officially Approved Languages.
What I mess around with, when I’m messing around with code recreationally: currently Elm. Why? Because functional reactive programming is a freaking awesome idea, and Elm makes it actually make sense. Also, whereas Python supports antigravity out of the box, Elm supports time travel.
What I would use if I needed to write code that would run fast and handle user traffic: Go. Why? Because it is efficient, safe (from buffer overflows and the like), and makes concurrency really easy. There’s not really any such thing as high-performance code without concurrency these days. Safety matters a lot, too — the last project I wrote in Go was an SSH honeypot to log the usernames and passwords that attackers try. It helps that Go code is clear enough that I could actually read enough of the crypto libraries to have confidence that I wasn’t going to regret it.
Other languages I like for one reason or another: Haskell and Lisp, for expressing two deeply contrary ideals on what programming is.
I fear this post is kind of too open-ended and prone to language wars. I suggest a poll instead or a somewhat more focussed question.
What we’ve got from this question so far is some specific comments on merits and demerits of a bunch of languages. A poll wouldn’t (necessarily) have given that. And so far there’s not a lot of language-warring.
I agree that a more focused question might well meet AspiringRationalist’s goals better, but as far as general discussion goes I don’t see that the question s/he actually asked has done much harm.
I agree. But maybe my warning contributed to there being no war. Kind of self-defeating prophecy maybe?
Yup, could be.
Python for casual stuff—it’s powerful, the code doesn’t become incomprehensible 6 months (or 6 hours) after writing it, and the design is coherent enough that returning to it after a short period of disuse doesn’t involve too much painful swapping everything back into memory. Main downside: the usual Python implementation is really slow. (For some categories of calculation-intensive task, Numpy mitigates this. It’s not too hard to extend Python in C or C++. There’s an implementation of Python called PyPy that runs some code much faster, but is much more memory-hungry.)
I tend to say that Common Lisp is my overall favourite programming language, but I’ve written hardly any in the last decade or so. Admittedly that’s mostly because in the last decade or so most of my programming has been done at work where language choice is usually determined by factors other than my general preferences. CL’s pretty nice, though: it has roughly the usual set of useful datatypes found in modern languages, is highly extensible both syntactically and semantically (via “reader macros” and ordinary macros; C users should note that CL’s macros are not at all like C’s), has a reasonably capable standard library, and can be made to run pretty fast despite being dynamically typed. Downsides: the syntax is a bit clunky in some respects (e.g., there are hash-tables but no literal syntax for making them), some kinds of genericity we’re used to nowadays—e.g., being able to use the same code to do standard things to anything that “behaves like a sequence”—aren’t there, and because it’s not a popular language nowadays there’s much less chance that someone’s already solved 90% of your problem than there is in, say, Python or Ruby or even C++.
I retain a soft spot for good ol’ C, but reluctantly concede that these days you generally want to be using C++ rather than C for really performance-critical work. But C++ is a very unlovable language. (Recent versions have made a lot of things nicer, if you do things the “modern” way—but most of the C++ code I deal with day to day has to run on very resource-limited embedded processors, which means we generally avoid a lot of the standard library, and has to be able to build with old compilers, which means a lot of those nicer friendlier features might as well not be there.) I have hopes that Rust may turn out to be a “better C++” but it’s early days yet.
On the thankfully rare occasions when I need to write something Windows-GUI-ish, C# is actually a pretty good tool these days. In particular, LINQ is pretty cool (comparable to Python’s comprehensions but uglier and more capable).
I still use Perl for exactly one purpose: one-liners in the shell for tasks just one notch up from what a single grep invocation will do.
For numeric stuff I regrettably tend to use MATLAB (which was well established at my current employer well before I got here). Python/Numpy would be a pretty good alternative—as a programming language MATLAB is maybe one step above INTERCAL—but isn’t so convenient for interactive use, which is quite a big deal.
Things I have a constant sense of nagging guilt for not having looked at properly yet: Julia (might make a really good replacement for MATLAB/Python+Numpy), Haskell (clearly very powerful and elegant, and lots of language-theoretical stuff happens there), Go (clearly not in any way an interesting language, but for its niche—pretty much anything you could call a “server”—it seems well designed), Racket (seems like they’ve grown Scheme into something really capable, and maybe it should be taking CL’s place in my heart).
Doesn’t ipython solve a lot of the issues of convenience for interactive use?
Yes, ipython is nice and plays well with matplotlib. But there are some things MATLAB still does a lot better. For instance: make a 3d plot and move your point of view around with the mouse. Trivial in MATLAB, impossible in ipython/matplotlib.
I got tired of the lot of them, and set out to build my own. That was a rabbit hole.
Just out of curiosity, what design did you follow?
Mostly “functional”-style, in the sense of having algebraic data types and expressions as the chief syntactic construct, but with this system of subtyping and objects for the things like modules and closure types that actually need the existential type. I ended up writing my own type-inference algorithm, which I’m still formalizing in Coq now.
Rabbit. Hole.
Sounds like loads of fun :)
I prefer to use Ruby when possible, though I switch to Python (with numpy) for more math-heavy applications. Ruby’s ability to chain methods, syntactic sugar, and larger amount of built-in methods makes programming much more fun and efficient than Python, where I’m constantly going back a word to write a new method and enclose what I just wrote in parentheses, or counting parentheses/brackets, which I don’t really seem to need to do in Ruby. Python is still much more enjoyable to program in than most other languages, but compared to Ruby, it feels like programming backwards. I also prefer to use Ruby/Rails for prototyping and web development.
Prefer:
Scala (for large server-side programs). Static types and functional programming, with access to the Java ecosystem/libraries. Some of the more advanced type system features are too complex/abstract for my taste and the most popular build system, SBT, is horrific.
Ruby (for quick scripts) . I have a slight aesthetic preference for it over Python but Python would probably be just as good.
Tolerate:
Java. Kind of a lesser Scala but with very solid tool and framework support. Java 8 adds some decent functional features but it can still be pretty clunky and verbose.
C#. Similar to Java (though I have little experience with it).
Dislike (based on little experience):
C++. Too many arcane rules, too easy to screw up.
Perl. Like Ruby or Python but with syntax that is much more complex and idiosyncratic for seemingly no benefit.
Mixed:
Clojure. Some great features but I dislike dynamic typing for large projects and also dislike the Lisp syntax.
Javascript. Appreciate the simplicity of the core “good parts” but is dynamically typed and I don’t like the prototype-based object system.
Interested in:
Rust. Seems like it could be a nicer language for the cases where C++ is warranted. Waiting for 1.0 to come out before trying.
My general rule of thumb is
I love the simplicity and power of Python and will use it to prototype proof of concepts (not so much GUI work—would use HTML or .NET for that). For me, Python really makes programming a lot of fun again and though it is slower, I haven’t yet had the need to shell out to C code though I expect I will soon.
I’m currently developing Autocad extensions, so I work routinely in AutoLisp, but pure Lisp implementations are at best outdated. So I was very interested when Clojure came out. Now that I’m tackling video-games with HTML5/CSS/JavaScript, ClojureScript might become a very interesting alternative.
I was also very fascinated by Scheme’s call-with-current-continuations, so I’m hoping they will implement in Clojure.
I think targeting the JVM (as Clojure does) makes that difficult. I may be way out of date, though.
I’ve read that call/cc can be emulated with continuation monad, and monads might just be parte of the next core… I’ve yet to dig into the issue, though.
Java; for web applications; because I have most experience in it and I also like statical typing.