Absolutely everything* you need to know about picking a first programming language

Absolutely everything* you need to know about picking a first programming language

When you’re getting into programming, one of the most stressful parts is right at the beginning: Which programming language should you pick? If you ask a coder for advice, nine times out of ten they’re going to recommend the language they use; it works for them, so it should work for you just as well, right?

Well, not really.

It isn’t that you can’t write a program in any language (you can!); it’s that down the road when you start to use the programming language, you might run into a bump or two. If you’re looking for a job, you might want to pick a more popular language. If you’re looking to get into a specific field – say data analysis or game design or interactive visualizations – you’ll want to pick a language that’s better suited for the task.

Let’s take a look at the pieces that make up a programming language, and then examine a few of the more popular languages to figure out what’s a good fit for you. We picked Python for the majority of what we do in the Lede Program – maybe you’ll see why!

What’s a programming language?

In their heart of hearts, computers talk something like this:

00101110100101010010010

Whether you’re multiplying huge numbers or Googling cat pictures, every single computer instruction is broken up into an unreadable series of 1’s and 0’s called binary code. Since humans aren’t so good at communicating in binary, we invented programming languages to serve as an intermediary.

Programming languages that are closer to binary code are called low-level languages, while more human-seeming languages are high-level.

The CPU in your computer understands a certain set of instructions, like “move this value,” or “add these two things,” or “jump to this set of commands over here.” The lowest-level programming language you can learn is called assembly language, which does you the service of converting these binary instructions into simple words like MOV for shuffling numbers around in computer memory.

All those lines, and all it does is move a couple numbers around inside the computer! You’d need a ton more to even think about printing something to the screen.

Most every language you’d pick up as a first language is a high-level language. Within these languages, though, there’s a continuum – C, for example, can get much closer to “shuffling numbers around in computer memory” than something like Python can. Is it better to pick something lower-level to become familiar with how a computer works, or something higher-level so you can focus on actually creating things? I tend to fall into the second camp, but there are arguments to be made on both sides.

Programming Language Selection Criteria

When you pick your programming language, there are a few things you’ll want to think about.

Ease of writing

Every language has its own idiosyncrasies that separate it from the English language. Maybe there are brackets and semicolons all over the place, or every line needs to be numbered, or it’s really picky about indentation. The higher-level a language is, the easier it’s probably going to be for you to understand as “normal English.”

Ruby, Python and Perl are on the more English-looking ends of the spectrum.

Pickiness

Some programming languages are also pickier than others about what you can and cannot do.

For example, maybe a language likes to keep words and numbers really separate, and wouldn’t let you combine the number 4 with the word “dogs” no matter how nicely you asked it. A less strict language, on the other hand, might even let you multiply 3 * “dogs”, giving you “dogsdogsdogs.” A language that lets you play loose-and-fast gives you the opportunity to get more coding done more quickly, but

Ruby and JavaScript are two of the least strict languages, while C++ is on the stricter side.

Popularity

The TIOBE programming language index is the standard popularity metric for programming languages. It ranks languages based on the number of engineers using them worldwide, and provides a guide as to what’s rising and what’s becoming less common. I find it a pretty useless metric, but some people seem to enjoy touting the numbers.

Use case

While popularity is important if you’re looking to get a job and you don’t particularly care what that job is, usually you have a task in mind when you want to learn to code. Different programming languages are better suited (or are simply more popular) for some tasks than others, so you’ll definitely want to select a language that’s in line with your end goal.

For example, Swift is a language that Apple introduced in 2014 for making iOS and OSX apps. If you’re looking to build a web page or program for NASA, it’s probably not a good choice, but it’s certainly an option if you have your eye on an Angry Birds clone!

Ease of development/setup

Some programming languages work best in (or even require) different environments. Some might operate in slick interfaces on your desktop, while others might need a web server or physical piece of hardware to run. Sometimes it’s best to start off with something that’s easier to hit the ground running with instead of spending all your time tooling around with setup.

Programming Languages

I’ll give a short bio of each language, along with a Hello world – a simple, sample program to let you get a feel for how the language looks.

C/C++

C is a fast, lower-level language that has been around since the early 1970’s and is used all over the open-source ecosystem. While it has waned in popularity thanks to its higher-level, friendlier descendent C++, C is still used widely in embedded systems (think tiny computers, like your router).

C++ is a popular general-purpose programming language. It’s useful in itself, and it also provides a great foundation for concepts you’ll find when learning other languages. It’s a big deal everywhere from game programming to an Arduino’s blinking lights – building websites is one of the only places you won’t find C++.

Java

Java is a high-level programming language that is arguably pretty similar to C++. Whereas C++ was released in 1983 as an extension of the C language, Java was written from scratch and released ten years later. This difference in heritage highlights the strengths and weaknesses of each: Java is more focused on general-purpose computing, ‘modern’ computer science design principles and self-containment; while C++ can be a bit closer to lower-level C programming and is built for speed.

Java is more common in business software environments, and can often be found driving complex, enterprise websites. While we could split hairs all day, I think this Stack Overflow question has some good insight in the comments, including: “Starting out with C++ is like learning to cook in an industrial kitchen. It’s easy to put the heat on too high, and there are a million things going on at the same time.” Java is currently #2 on the TIOBE list, beating out the third place contender (Objective-C) by almost 50%.

Java is also the official language for Android development.

Objective-C

Prior to the 2014 introduction of the language Swift, iOS and OS X applications were written in Objective C. If you’re curious about Objective-C, you should probably try Swift instead!

C#

C# is another relative of C, developed by Microsoft and released in 2000. It’s more or less Microsoft’s answer to Java, and is currently #5 on the TIOBE list, right behind C++. While most programming languages are platform-agnostic between Windows and OSX, C# is probably best for folks who are happy on Windows machines.

PHP

While PHP is #6 on TIOBE, it’s definitely the most popular programming language for building dynamic websites (sites with users, blog posts, databases, high scores, etc.). It comes preinstalled on most web servers, and maybe even on your own computer. With little-to-no setup process, PHP users can simply drop a .php file into a directory and be good to go.

The downside to PHP’s ubiquity is that there’s a lot of really bad PHP code out there and it’s easy to pick up bad habits and insecure coding practices. The language itself has a few quirks as well, leading to sites like Why PHP Sucks and jokes like this:

php-the-good-parts

Despite these downsides, PHP is still well worth learning. WordPress is built on PHP, so if you’re interested in working on WordPress sites or plugins, it’s definitely the path to take. If you’re interested in taking your coding offline, though, PHP won’t be for you.

JavaScript

Once upon a time, JavaScript was nothing but a little language that sat in your browser and did tricks like make sparkles follow your cursor, or create annoying popups. In the early 2000’s, though, JavaScript went through a renaissance and emerged as the powerhouse that crafted the modern web. Most all fancy interaction  online is done via JavaScript – web games, interactive visualizations, infinite-scrolling web pages, etc.

In the past few years, JavaScript has leveled up yet again with the advent of node.js. Previously, JavaScript only existed in your browser, but node.js brought it to the “server side,” allowing you to write entire programs in JavaScript. The ability to use the same language both in the browser and on the server has turned a lot of heads, and as a result, JavaScript has seen a tremendous amount of growth.

Java and JavaScript aren’t really related at all – JavaScript’s developers just borrowed the name for PR’s sake. The joke goes that Java is to JavaScript as car is to carpet.

Python

Python is a high-level, multipurpose language in the company of Perl and Ruby. This set is divided from Java/C++ in that they are what’s known as scripting languages. A scripting language is sort of a quick-hit program that can be turned into binary code on the fly, instead of needing to be packaged up (compiled) for the computer like Java and C++. This makes scripting languages convenient for the layperson interested in fooling around and seeing results set up nice and quick.

Python is widely used in academic work due to a broad support base of extensions and libraries. Difficult-to-conquer problems like language processing and statistical analysis don’t need to be redone from scratch; you can instead just use a well-established set of code that someone else has contributed to the world.

Python can be wrangled onto the web with frameworks like Django or Flask.

Perl

Perl is a scripting language that is commonly associated with systems administrators as a “get something done” language. It was developed in 1987 as an extension to the command line to help ease processing tasks. I think Wikipedia sums it up well with the line:

In 1998, it was also referred to as the “duct tape that holds the Internet together,” in reference to both its ubiquitous use as a glue language and its perceived inelegance.

While Perl is practical and useful, it’s not the best choice for those looking to internalize computer science concepts.

Swift

Swift replaced Objective-C as the Apple-endorsed language for iOS and OS X apps. If you have an eye on iPhone apps, Swift is your new best friend.

Ruby

Ruby was developed in the mid-90’s by the Japanese developer Yukihiro Matsumoto, who felt that a programming language should reflect good user-interface design. It, like Python or Perl, can be used for command-line tools or to build the backend of websites.

Ruby was popularized in the mid 2000’s by the rapid ascent of Rails, a framework that works with Ruby to create websites. Everyone and their mom was suddenly a Ruby developer! The past few years have seen a “trendy programming coup,” however, with node.js emerging as a claimant to the throne.

While it doesn’t have the strong scientific library support of Python, Ruby is an elegant-looking language that still has plenty of wind in its sails for web development.

R

R is a programming language built for statistical analysis. While Python has tried to steal some of its thunder with tools like pandas and IPython Notebooks, it remains a strong contender, albeit lacking the multipurpose background of other languages.

Other languages

There are a million and one other languages, but this is a solid list of the options that you’ll face as possible first languages. Let me know if I’m missing anything!

But what should you actually learn?

Information overload, am I right? Let’s see what we can do to round up all these languages:

  • General programming, without computer science theory: Python or Ruby
  • General programming, plus computer science theory: C++ if you want difficulty, Java if you want adaptability
  • Interactivity on the web (incl. visualizations): JavaScript (It’s actually your only option! Nothing else runs in the browser.)
  • iPhone apps: Swift
  • Android apps: Java
  • Games: JavaScript, since it’ll work for web-game frameworks like Phaser as well as the scripting in heavy-lifters like Unity
  • Making web pages: You’re looking for HTML and CSS! While they aren’t programming languages, I thought I’d give them a mention. Later on you’ll probably want to learn JavaScript.
  • WordPress: PHP
  • Making web applications: Ruby, Python, or node.js (flip a three-sided coin)
  • Data wrangling: Python

And remember: this is picking a first programming language. Learning to code is like learning to talk – once you get a few concepts down (variables, loops, maybe objects or libraries), you’ll be set to conquer any other language you set your sights on.

But I disagree wholeheartedly with your selections!

I know, I know, we all have our own opinions. In the end, the most important programming language is the one you enjoy and stick with. In my perfect world, we’d all sit around and gaze upon beautiful Ruby code, but that isn’t going to help anyone looking to wire up an Arduino.

Have more programming language questions, suggestions on other options, or virulent disagreement with my characterizations? Comment below, drop me an email or find me at @dangerscarf.

If you’re curious in learning more about the intersection of data, coding and visualization, check out the Lede Program – an intensive certification program at Columbia’s School of Journalism, in conjunction with the Department of Computer Science. Find out more on our mail page – applications are open soon!

Want to stay up to date on the Lede Program?

  • Andrew Paul Browne

    Really great post jsoma. Really like how you align the programing languages with their common applications. One thing I find interesting is how javascript has libraries for things like R and Processing. These tools can be very rewarding because they display on the web.

    • jsoma

      Glad you enjoyed it! A lot of my earlier work was done in the original version of Processing, which would generate Java applets for you to embed on the web. Getting them to work right was a real pain in the neck, it’s definitely great that we have so many native JavaScript options these days.

  • Hozella

    Lovely article jsoma.. Really breaks down all the languages and gives direction where I want to go. Thanks & cheers