beanz Magazine

How to Pick a Programming Language

US National Archives on Flickr

When you pick a programming language to learn first, it helps to figure out what software you want to create.

Whether you’re just learning to program for the first time or if you’re already old hat, there’s never a bad time to learn a new language. Just like with human languages, learning a new programming language teaches you new ways to think and allows you to work with even more people.

The problem, though, is that there’s just so many programming languages out there. How do you choose one to learn next? Now, if you search for best programming language online you’ll probably find a few million arguments. However,I’m going to say there really isn’t a single best language for all projects or all people. You might find a language you enjoy best and that fits well with how you program, but your choice is as personal a preference as your favorite food or YouTube channel.

We’re going to go through this by first asking you to think about what you want out of a new language, how you’re going to use it, and what you like in a language. Ask yourself the following set of questions and it should help you pick from the languages we list or something else entirely.

First, what do you want out of a new language? Are you learning to program for the first time? Do you want to learn something really different than anything you’ve learned before? Are you planning to write code on your own or with other people on an already established project?

Next, what do you plan to do with a new language? Are you wanting a general purpose language for when you next have some code to write? Do you want to program hardware like the Arduino microcontroller? Do you want to learn how operating systems work? Are you interested in programming for websites or making applications for phones?

Finally, it’s okay to choose a language based on how it looks and how it reads and how much sense it makes to you personally. Liking the way the code looks is probably a sign that it’ll fit with how you think. To that end, we’ll be including little code snippets in our description of each language.

That all being said, here’s some of my recommendations about languages to learn and why. It’s not comprehensive, though, and is just some of my choices for good things to pick up and my reasons for why you might want to learn them.

Games, Hardware, and Operating Systems: C and C++

C and C++ are very closely related languages, with C code often, though not always, being valid C++ code as well.

C is one of the oldest programming languages still used and C++ itself is over twenty years old. C really teaches you to think about how code runs on a computer because you access most data by its actual address in memory and know how your data is actually structured from the computer’s perspective, both of which are things you don’t need to ever worry about in most languages.

This is great if you want more experience with low level programming, if you want to understand how operating systems work (every major OS has a core of C code), or if you’re interested in programming hardware like the Arduino.

C has a similar look to a lot of other languages, because it influenced so many languages that came after it in the last forty years. C and C-like programs have to be read from the top to the bottom.

For example, the following is a simple C program that initializes a variable myVariable, creates a function ourFunction, and then uses the function to print out a message.

#include
int myVariable = 10;

int ourFunction(int arg) {
return arg + 10;
}

int main() {
printf(“The value is: %d”, ourFunction(myVariable));
return 0;
}

C++ is a similar but much bigger, language. Unless you have a project that specifically needs C++ I think it’s good to learn C first just because it’s a simpler, cleaner, language that teaches a lot about programming.

Both C and C++ are used a lot in big AAA studio games programming, so if you want to one day work for a major video game studio you could do far worse than learning how to write C and C++.

Mobile Programming: Java, Swift, and Go

If you’re interested in programming mobile apps, then your choice of language is mostly restricted by what platform you want to write for.

If you want to write apps for Android, then the main language Google wants you to use is Java. Java has a C-like syntax, which you can see from the following translation of our C example above into Java:

class MyClass {
static int myVariable = 10;
static private int ourFunction(int arg) {
return arg + 10;
}
public static void main() {
System.out.format(“The value is: %d”, ourFunction(myVariable));
}
}

You can use Google’s language Go for programming Android as well, but it’s currently less supported than Java.

If you want to write apps for iPhones or iPads, then your main choice is to use Swift which Apple made specifically to make applications for their devices.

Web programming: JavaScript

JavaScript, which has nothing to do with Java, is the language that makes the web work. If you have any interest in how to make web pages that can do interesting or cool looking things, then you pretty much have to learn JavaScript. That’s because every browser gives JavaScript a special role where JavaScript code run in your browser can change the webpage in real time.

JavaScript is essentially the reason websites like Twitch and YouTube and Facebook are really interactive instead of web sites like in the 90s where you just had text and links.

JavaScript also has a very C-like syntax but under the hood is a very different language with its own fairly unique features. It’s also a fairly easy language to pick up and is one I also recommend as a first programming language.

If you like math class: Haskell

Haskell is in the middle of the pack for obscurity on this list. It’s one of my favorite languages, though, and one that you should take a look at if you enjoy math class.

Unlike C, it encourages you to think of the program like a math expression rather than a little machine. Haskell programs don’t run like lists of directions for the computer, but rather like the way math like (3+2) + (10 * 4) is calculated. It runs the pieces of the expression and then combines them together the same way you’d first calculate the things in the parentheses before adding them together.

For example, here’s a program that takes two lists of numbers, adds them together, and prints them out:

list1 = [1..10] list2 = [11..20] main = print (zipWith (+) list1 list2)

So if you find C-like languages ugly, don’t like thinking about memory addresses, or just really like your math classes, then Haskell is a solid language with a decently sized community that teaches you how to think of programming differently than almost every other language in this list.

Popular and easy to learn: Ruby and Python

I include Python and Ruby together because they fill similar ecological niches in the landscape of programming languages, even though they look pretty different from each other.
They’re both easy to pick up and use, and so are both good first programming languages. They’re also both incredibly popular which means that you can find a lot of cool projects done in both. For example, Python has its cool game programming libraries like Pygame and RenPy. Ruby has a great system for writing music in Ruby called Sonic Pi, which lets you just put music pieces together as code.

Both of them also deviate a bit from the C-like syntax of other languages. Here’s a Ruby loop for printing all the odd numbers between 0 and 100:

(0..100).each do |i|
if i % 2 == 1
puts i
end
end

and in Python it looks like

for i in range(0,100):
if i % 2 == 1:
print(i)

Honorable mentions

CoffeeScript is a language you can use in the browser that’s essentially JavaScript with a different syntax that’s less C-like and some convenient features added

Idris superficially looks like Haskell, but with a lot of interesting features like the ability to prove that your code is correct before you ever run it. It’s still a pretty obscure language right now, but I think it’s one to watch out for.

Clojure looks and acts fairly differently than all the other languages we’ve talked about. Being a “lisp” language, which is a family of languages even older than C, (it ((has all) sorts of) parentheses everywhere). On the other hand, it also has a lot of built in support for metaprogramming, which is when you write code that creates other code.

x86 assembly is the language that the processors in your laptop or desktop computer understands. It describes the actual physical operations that the processor is supposed to execute. Every other programming language has to be turned into assembly so it can be run, but writing assembly by hand can teach you a lot about how computer hardware actually works.

Learn More

Popular Programming Languages

Index is updated annually is generally impartial.
http://www.tiobe.com/tiobe-index/

State of the Octoverse 2016 (Github)

Popular languages based on use within their vast community.
https://octoverse.github.com/

Which programming languages are most popular (and what does that even mean)?

http://www.zdnet.com/article/which-programming-languages-are-most-popular-and-what-does-that-even-mean/

List of programming languages

https://en.wikipedia.org/wiki/List_of_programming_languages

Comparison of programming languages

https://en.wikipedia.org/wiki/Comparison_of_programming_languages

Choosing a Programming Language Systematically

http://softwareengineering.stackexchange.com/questions/258479/choosing-a-programming-language-systematically

How to Choose Your First Programming Language

https://www.kidscodecs.com/how-to-pick-a-programming-language/

Also In The February 2017 Issue

This cryptography method is based on the fact some tasks are relatively easy to do, but extremely difficult to undo.

There's a way to find out if your online passwords have been stolen, and how to prevent it.

Racket is a fun and easy programming language to learn because it's all about creating colors and shapes as you learn.

Networks are a mostly hidden but critical part of the internet.

Surveillance cameras, satellites, RFID tags, and social media activities all create unique digital footprints.

Developers deal with common problems in their work. Here’s are a few problems and how to overcome them.

Programmers use libraries but instead of books they create and share code, often for free, to help solve common problems.

These cards are a fun way to learn Scratch, look up how to do things, and make applications.

Another mysterious four-letter acronym that helps secure information online.

Dorothy Vaughn, Mary Jackson, and Katherine Johnson not only helped make history, they are part of a long line of women in computing

It's almost time to think about summer tech camps if your kids are interested. Here are a few questions to ask.

Your web browser knows (and tells) a lot more about you than you might realize.

When you pick a programming language to learn first, it helps to figure out what software you want to create.

This odd acronym offers security protection beyond your password. Here are a few examples of how 2FA works.

Links from the bottom of all the February 2017 articles, collected in one place for you to print, share, or bookmark.

Interesting stories about computer science, software programming, and technology for February 2017.