What are all these programming languages good for?
April 18, 2013 4:57 PM   Subscribe

Ruby, Python, PHP, JavaScript, etc! Help me bring my very outdated coding skills back from the grave! Can anyone either explain or point me to a good resource that explains concisely why I'd want to use one programming language vs another?

So, I used to be reasonably good at programming on the hobbyist level. However, this was back in the days of Turbo C++ and DOS 5. Not exactly cutting-edge anymore. For various personal reasons, I've decided to refresh my coding skills and join the 21st Century, but I find I'm at a loss for where to begin. I keep reading about a number of programming languages that I could be using, but it's not at all clear to me why I would choose one over another. I'm completely overwhelmed. Can anyone help enlighten me please?

While I don't have any specific big-picture projects in mind, I probably would want to be able to do at least a little light data analysis. Assume that I'm totally fine with basic coding structure, and comfortable with object-oriented structures.

Thanks for helping an old dog try to learn some new tricks.
posted by Guernsey Halleck to Computers & Internet (29 answers total) 60 users marked this as a favorite
I'm not a programmer, but I'm a consumer or programming services and it seems to me what's hot now is javascript (node.js, etc.). That gives me the feeling that if I were going to learn to be a programmer, that's the one I would learn. But I'm sure some programmers here can give you additional insight. And of course it depends ultimately on what your short AND long term goals are.
posted by Dansaman at 5:02 PM on April 18, 2013

If you could handle C++ you will love the ease an simplicity of many contemporary languages. Some elements may make you nuts but work through it.

Javascript is the only native language embedded in every browser.

PHP is reasonable choice for a basic web site that does not do a lot of computation.

Ruby & Python are general purpose languages that have differing strengths. Python has strong scientific and statistical libraries. Ruby on Rails has ties to commercial web sites, it has conventions that allow bringing a functional database backed online site literally in minutes. Think about what you want to do and research what folks that do stuff like that are using.

Then look at Erlang, Closure or joke languages like whitespace and the dozens of other recent languages and it'll really be a dive into the matrix.
posted by sammyo at 5:15 PM on April 18, 2013 [1 favorite]

Best answer: Which language you choose is really down to what you want to accomplish with it, IMO. Do you want to do mobile app development? In that case you should look at Objective-C (for iOS) and Java (for Android). Do you want to build websites? Then you should look at Ruby or Python and Javascript.
posted by asterix at 5:17 PM on April 18, 2013 [2 favorites]

I've been hip-deep in Codecademy.com for the past two weeks. Currently learning Python.

This page gives you a 3--point description for each of the topics they offer courses on, including PHP, jQuery, Javascript, and Ruby.

If you already have a strong background in programming, you might just blast through all the exercises in a day.
posted by boghead at 5:23 PM on April 18, 2013 [3 favorites]

Python is great (I'm learning it now) but can be frustrating getting certain libraries to work if you're in a Windows environment. I spend the majority of my time programming in R and love it. If you have any interest in stats or data management it's a great (free) alternative to SAS, Stata, and SPSS.
posted by playertobenamedlater at 5:40 PM on April 18, 2013

Python is a popular language with a lot of teaching material available online - a good general purpose language while still having a lot of solid scientific/data analysis libraries and community around that. R is less popular but does have plenty of teaching material and is more focused on strictly data analysis. I would pick either of them, depending which way you want to go with it.
posted by jacalata at 5:45 PM on April 18, 2013

Every language has its own benefits and drawbacks, affordances and weirdnesses. So you should really pick a project you want to do, and then pick a framework that will facilitate that project, and then learn the language that the framework uses. (e.g., if Processing looks interesting, learn it and you'll learn Java; if NLTK looks interesting, learn it and you'll learn Python.)
posted by aparrish at 6:13 PM on April 18, 2013 [3 favorites]

Supposedly, Lisp is a powerful language. Here are Paul Graham's list of Lisp resources. He is very pro lisp.
posted by Michele in California at 7:04 PM on April 18, 2013 [1 favorite]

If you want to get up and running fast, choose Python. If you want to do web stuff, choose JavaScript. But if you want to attain enlightenment (and aren't too concerned about marketability), choose a functional language.

I've been using Scala lately, and I really dig it. It has an interactive interpreter mode, a great static type system with type inference, functional language fold- and map- kinds of things, first-class functions, and great Java compatibility that gives you access to Java's huge range of libraries.
posted by qxntpqbbbqxl at 7:10 PM on April 18, 2013

If you want to keep going with the low-level, imperative stuff, I think you'll really like C99 or C++. I have never met anyone who enjoyed writing hobby projects in Java, although I've met a couple of people whose interesting projects *were* Java (e.g., somebody from the Guava team). Plus, I'm sure gcc has added some neat optimizations in the last couple of decades.

There's also some neat work going on with general-purpose GPU (GP-GPUs). OpenCL is probably the closest any of us are going to get to programming on a Cray vector machine.

Or, if you want to make a big break, go either dynamically typed (Python, one of the Lisps, Ruby), or statically typed with a real type system (OCaml, Haskell, maybe kinda Scala), or functional (OCaml, Haskell, a Lisp).

If you're going to do something functional and mind-expanding, I strongly recommend SICP and strongly advise against its watered-down cousin HtDP.

If you want to try some macros, Paul Graham literally wrote the book On Lisp.

Maybe you should try Seven languages in seven weeks?
posted by d. z. wang at 7:48 PM on April 18, 2013 [2 favorites]

Oh, hey, I just realized you've probably never had garbage collection! You're going to have a lot of fun!
posted by d. z. wang at 7:49 PM on April 18, 2013 [2 favorites]

If you're running Windows, Microsoft has free versions of their C# and C++ Visual Studio tools, which are limited but fine for hobby programming. Lots of game developers, both pro and amateur use these.

You might also enjoy installing Linux (Ubuntu or Mint are good distributions) and messing with the 100s of command-line tools available.
posted by RobotVoodooPower at 7:50 PM on April 18, 2013

Pick one compiled strongly-typed language and one interpreted loosely-typed language. Say, C++ and Python. Or C and Javascript. Or Java and Ruby. Between the two families you can regain the habits you'll need to jump into any language. My general advice would be for your interpreted language, Python is hard to go wrong with. Ruby and JS are both wonderful, but Python is a more understandable and generic hammer. For your compiled language, I'd say either Java or C++, depending on what you want to end up programming.
posted by introp at 9:35 PM on April 18, 2013 [1 favorite]

How would you explain concisely why you'd want to speak one natural language or another? There might be practical reasons: maybe you were born in Kuala Lumpur and everyone around you was already speaking Malay, or you took Spanish in high school and already have 12 AP credits and it seems pretty useful anyways. There are more romantic reasons, too, most all related to what you want to do. Maybe you love Akhmatova and want to read Requiem in Russian, or you want that girl at the cafe to catch you reading Le Diplo, or you're just curious by nature about unusual things and read the Wikipedia article on Hungarian grammar.

The wonderful thing about programming languages is that they're much easier to learn and almost always completely free to try. It took me four years of chronic error to speak Turkish with any proficiency, but just a few weeks to get comfortable enough to write something simple in Python, and then JavaScript, and then R and Ruby and Objective C and Haskell and Go and many others. It will take ten years to master any one of them, but it doesn't cost much to keep trying until you find one that lets you express the things in your head in a way that feels natural (for me, Clojure). The catch, of course, is that you actually have to write some code to discover it. Don't worry—if programming used to be a hobby, a familiar joy (or compulsion) will return.

So where are you? How many transfer credits do you have? Whose code do you want to read and what do you want to accomplish? What are you curious about? (You have a few answers already.) If you resist the urge to ask "which language should I pick forever," and focus on "what language should I use to solve today's problem," pretty soon you'll have used many of them—and one may even pick you.
posted by ecmendenhall at 9:56 PM on April 18, 2013 [1 favorite]

Best answer: By way of background: I'm a staff scientist at an academic institution, where I do everything from dealing with server hardware, to leading teams, to writing code, to writing grant proposals to fund our work, and often face the question of which language to choose for a project. Here's my quick take:

• You cannot go wrong learning Python today. It is widely used, it has great libraries for data analysis, it's easy to learn, and pleasant to write in (IMHO – but many people also agree). There is a great notebook system available (IPython). Some possible downsides that come to mind are: (1) whitespace matters in code indentation, a characteristic some people hate; (2) installation of packages is often a frustrating process. If you want to get started with Python on Windows, I suggest looking at the Entought distribution, which has a free version that bundles a lot of useful package in a one-shot installation.

• JavaScript is another good choice today. It was originally designed to be a scripting language for web pages, but the technology has expanded and matured incredibly, to the point where you can write standalone applications in JavaScript too. It is an easy language to learn and use, though it is also a fairly loose language, which is a two-edged sword: it's easy to write things and make them work, but it's easy to write bad code that is harder to maintain over time. There are a number of frameworks for JavaScript and coding guidelines that help counteract this. There are also a lot of graphics libraries written in JavaScript, such as Highcharts, D3, and many others, which makes JavaScript an excellent choice for writing web-based visualization applications. When I need to write something that displays plots or implements the logic for something in a web page (e.g., menus), I reach for JavaScript.

• PHP is most useful for writing dynamic web pages and websites. If you want to write a web page that pulls data in from somewhere (a local database, or a remote service), performs some calculation or transformation, generates the HTML for a web page, etc., then PHP is a popular choice. However, it is not the only choice; you can do all that with other languages (e.g., JavaScript), though the architecture of how you do it would be slightly different. My opinion, however, is that you wouldn't need to learn PHP unless you have a specific requirement to use PHP, such as having to extend an existing PHP-based system.

• Though it is much maligned, Java is actually a good language from many perspectives. There is a massive number of libraries for Java, which can save you a great deal of implementation time because you can often find what you need off-the-shelf. There are also GUI libraries such as SWT that are portable to all the big 3 operating systems and can give a close-to-native look-and-feel for an application. There are also very good integrated development environments available. There are data analysis and visualization libraries available too. I tend to reach for Java if I want to write a standalone application that anyone can run no matter which operating system they're using.

• C++ is another option. I personally dislike C++'s syntax and complexity, so I'm biased against it, but it is clearly a viable choice for implementing applications, including data analysis and visualization applications.

• C# and .NET is another option. One of my staff loves it and much prefers to use it, and I have to admit it appears to be a very productive environment. However, it is not something you can realistically use fully anywhere but Windows. For many of our projects, that's a deal-breaker, but it may not be for you.

For the kinds of tasks you described, my $0.02 worth is to suggest looking at Python or Java first, with JavaScript a close second choice.

People have mentioned some other choices in this thread, including Lisp. I started in computer science a long time ago, and for a long time, was a Lisp hacker. Let me tell you, I love Lisp. I miss it. I wish I could write everything in Lisp. But realistically, there is much more support for languages like Python today, and I just can't recommend Lisp as an alternative. Luckily, Python offer many of the same features that make Lisp so flexible and powerful (though using a completely different syntax).

R is a good data processing language, but it is not the same kind of language as Java or Python. If you were planning on doing only data analysis, I would recommend it, but because you have a goal of catching up on languages more generally and may want to do more general-purpose programming, R doesn't seem like a good match, at least not at the start.

Hope this helps!
posted by StrawberryPie at 11:19 PM on April 18, 2013 [11 favorites]

Best answer: I don't know of a good resource comparing these, although I think you'll find quite of a bit of information on them (and other languages).

The best thing you can do is dive in and make something in one or more of these languages rather than worrying about which is best.

My quick opinions:

PHP: pragmatic server side web development language. Not as well designed as the others but very widely used

Javascript: Currently the only real choice for web client development, the node.js runtime extends this to the server. Currently getting lots of attention as a possible 'next big thing'. Some weirdness in the language due to it being designed very quickly for inclusion in Netscape.

Python: Nice OO language with some functional features tacked on. Some nice web development frameworks.

Ruby: Another nice OO language with some functional features. Rails is the most well known web development framework for it but there are others.

I'd favor learning Python and / or Javascript for various personal biases. Maybe share more about your goals and we can narrow it down.
posted by mutagen at 11:29 PM on April 18, 2013

I would not learn R as a starter language. It has a number of problems. Perl or Python are fine for light data analysis. C++ is overkill for this task.
posted by Blazecock Pileon at 11:41 PM on April 18, 2013

The Hammer Principle describes many programming languages based on crowd-sourced ranking of statements about them.

For example, the top statements listed for Python are:
* I would use this language for casual scripting
* This language would be good for teaching children to write software
* This language is good for beginners
* Code written in this language is very readable
* I find this language easy to prototype in

and those for R are:
* This language is good for numeric computing
* This language has a niche outside of which I would not use it
* This language has a niche in which it is great
* This language is good for scientific computing
* This language has a good library distribution mechanism.

I know quite a few of the languages described on the site, and I think its characterizations of them are generally accurate.

For your "a little light data analysis" goal I'd be inclined to start with Python. For more heavyweight work, I'd use Scala.
posted by siskin at 12:15 AM on April 19, 2013 [3 favorites]

Response by poster: Thanks everyone. I've given some thought to what it is I actually want to accomplish, and it sounds like I'll need either JavaScript or PHP for the bulk of it. It sounds like Python also is pretty well-liked, so that's on the list as well. I'm thinking my next move will be to muck around a bit on Codecademy with those 3 languages to get a feel for their relative strengths, and go from there.
posted by Guernsey Halleck at 2:12 AM on April 19, 2013

I'm surprised no one mentioned SQL. It's not a sexy language, but if you're doing data analysis, there is a very good chance you'll be having to get data out of a database at some point, and SQL is the lingua franca of databases. Even if you end up using something like R for your analytical heavy lifting, you'll likely need SQL just to get the data you're after.

Also, if you're using a Windows environment, don't overlook Excel as a data analysis tool. It has several add-ins (Power View and the new Data Mining add-in) that make many simple data analysis a breeze. Of course, it's a black box -- you can't really control the underlying algorithms or even see which algorithms they're using, but that may not matter much at this point. I'm a data analyst in healthcare, and we use Excel + PowerPivot/PowerView constantly for quick analyses.
posted by TazmanianDevilWorshipper at 5:34 AM on April 19, 2013 [1 favorite]

C# and .NET is another option. One of my staff loves it and much prefers to use it, and I have to admit it appears to be a very productive environment. However, it is not something you can realistically use fully anywhere but Windows. For many of our projects, that's a deal-breaker, but it may not be for you.

"Mono" is the open source implementation of the .NET platform. The game engine Unity uses Mono. Unity is a very popular product in game development due to it's multi platform support. Here's a list of games made in Unity
posted by Green With You at 6:41 AM on April 19, 2013

As a PHP programmer, I'd like to say that unless you're specifically planning to be working on someone else's PHP code, avoid. PHP is a huge mess, with little to recommend it but ubiquity. For web applications you're much better off with Python or Ruby. (I'm partial to Ruby because I like the Rails stack, but there's no doubt Python is at least comparable in power and beauty.)
posted by tsmo at 6:55 AM on April 19, 2013

The language, the framework, the ecosystem, are all just bad.
posted by flabdablet at 10:28 AM on April 19, 2013

@Green With You: Yes, I agree there's Mono. I qualified my statement with "realistically use fully", though :-). The reason is that while Mono will let you do a lot outside of Windows, Mono is not yet a complete implementation of Windows .NET (as far as I am aware—I haven't checked on it for a year), which, depending on the particular features needed in a project, may or may not be an issue. The development environments are also, as far as I am aware, more complete on Windows. There is also some uncertainty about what Microsoft is going to do with .NET.

Just to be clear: I'm not trying to malign .NET; all of these comments are in the context of the OP's question.
posted by StrawberryPie at 10:28 AM on April 19, 2013

Just wanted to add that Javascript isn't just for web. For example, with Appcelerator Titanium you can "create native, hybrid, and mobile web apps through a JavaScript-based SDK" (for iOS and Android).
posted by Dansaman at 11:40 AM on April 19, 2013

People have mentioned some other choices in this thread, including Lisp. I started in computer science a long time ago, and for a long time, was a Lisp hacker. Let me tell you, I love Lisp. I miss it. I wish I could write everything in Lisp. But realistically, there is much more support for languages like Python today, and I just can't recommend Lisp as an alternative. Luckily, Python offer many of the same features that make Lisp so flexible and powerful (though using a completely different syntax).

Clojure! Clojure! Clojure! It's a beautifully-designed Type 1 Lisp with painless Java interoperability, a number of very nice libraries for whatever thing you want to do, and a really sophisticated concurrency model! Python and Ruby and JavaScript are all well and good (I'm a Pythonista myself), but if part of your motivation for learning a new language is having a really novel intellectual experience, OP, then Clojure is a really great way to do that while still being a very pragmatic choice. I think this is probably the best resource for someone who's looking to begin with the language.
posted by invitapriore at 12:31 PM on April 19, 2013 [2 favorites]

And yeah I'll have to jump on the bandwagon warning you away from PHP. It's not good and it's not fun. I should know, I've programmed PHP professionally, and I intend to never do so again.
posted by invitapriore at 12:36 PM on April 19, 2013

Just want to chime in to note that the people who are happiest with their programming language code in Python and Clojure. I can't find the source, but it's some old thing from Hacker News.

People are very enthusiastic indeed about Clojure, but being enthusiastic about it is a bet that the future will go the way Rich Hickey (the benevolent dictator-for-life of Clojure) thinks it will. He's a smart guy. He's an insanely smart guy, and charismatic in the way that programmers count such things (so not charismatic at all by normal standards, but convincing) but I would pick Clojure as a good 4th or 5th language, not a first one.

I have to nth not doing PHP for your first language. Perhaps people have told you that PHP is a web language, and so it is: but that's the only damn thing you can do with PHP. It is not the case that PHP does a better job at being a web language than Python or Ruby does. It is the case that nobody wants to make, say, a good machine learning library in PHP because of a slew of awfulness in doing so, whereas there are multiple good machine learning libraries for Python, say.
posted by curuinor at 7:36 PM on April 19, 2013

This is a late addition, but N+1th'ing not learning PHP. It's a holy hell of a mess of a language.
posted by introp at 9:59 PM on April 26, 2013 [1 favorite]

« Older Shortened URLs no longer work on my devices   |   What do I need to know about the cloud forest? Newer »
This thread is closed to new comments.