If you spend any time programming, either professionally or for a hobby, you’ve probably tried at least half a dozen different programming languages. But the first language you learn is special. It sticks with you, maybe forever.

Why are first languages so memorable? Maybe it’s the pain of that first syntax error. Or perhaps it’s the excitement of getting a tiny window on computer screen to finally bend to your will. But more likely, it’s because the first time around you aren’t just learning the syntax and structure of a language. You’re also learning the fundamental concepts of coding.

Some of these concepts are algorithmic building blocks that you’ll use in every language, like variables, loops, functions, and conditional logic. At the same time, you’re also learning the practices of coding — how to add good comments, break tasks down into smaller pieces, reuse code, and debug problems. All of these things start out as new ideas in your first language. They’ll be essential life skills in every programming language after that.

The perfect first programming language

So how do you pick a good first programming language? Ideally, you’ll find that one that has two qualities.

First, it should be accessible. Scary-looking assembly language is a definite no. Low-level memory management is also a hard pass. But complexity isn’t the only concern — languages that come with a lot of historic baggage, are tightly bound to clunky models, require awkward registration or deployment steps (mobile development, I’m looking at you) also fail the accessibility test.

Second, it should be practical. That means you can use your first programming language — once you’ve learned it — to create something. And then you should be able to share that something with your friends. A programming language that limits your creations to its own little walled garden isn’t nearly as much fun.

Here’s the bad news. There’s a tension between these two goals. In general, simpler languages have a more limited reach. More powerful all-purpose languages have added complexity and require extra boilerplate code just to get started.

That said, the choices today are better than they’ve ever been before. In the past, professional languages were mostly off-limits for new learners. Beginners had to begin with a deliberately simplified teaching language (like Logo, BASIC, Pascal, or Turing). But today, a beginner can start with a professional language and use it to learn programming. Twenty years ago, that idea would have cracked up a room of seasoned programmers.

© Matthew MacDonald

There are many paths to programming. In this article, you’ll see my three favorite choices, plus two more alternatives. Any of these languages is a good starting point for a kid or a complete beginner who’s learning to code for the first time.

1. Python

Good news: Friendly syntax, a thriving kid-focused community, and you can hit the ground running with Pygame, the perfect little toolkit for making games.

Pain points: More work for deployment, some unique language quirks, and no beginner-friendly way to make web apps.

The beginning of the classic Snake game, as written in Python

Python is a nearly perfect environment for new coders. Its clean, uncomplicated syntax is great if you’re intimidated by semicolons and curly brackets. In fact, Python’s syntax is often described as being the closest you can get to old-school BASIC without importing all of its bad habits. Python doesn’t need a lot of boilerplate to get started. And you don’t need to dive into the deep end of object-oriented programming to write simple programs.

But the best news is that Python’s approachability doesn’t come at the cost of real programmer credentials. Python powers plenty of professional applications, frequently ranks in the top five for most popular programming languages, and is almost certainly the fastest growing language of the past two years.

Python is a particularly good first language for kids. New programmers can go straight from simple “Hello world” programs to creating games with the wildly popular (but still approachable) Pygame toolkit. And there’s a huge community focused on using Python in computer education, which means you’ll find plenty of solid choices for beginner books and tutorials.

Python does have some language quirks — ideas that don’t cross over into other programming languages. For example, indentation isn’t just a way to make your code look nice; it’s a requirement that shapes how your code works. And object-oriented programming concepts are bolted on in a way that many (myself included) find messy. But no language is perfect.

Where Python runs into more significant limits is in its reach. If you’re a beginner building an application in Python, it’s up to you to distribute it like a traditional desktop application. And don’t even think about building a mobile app. (Yes, professional developers run Python to build server-side web applications, but that’s not an easy entry point for new learners. Python beginners mostly stick to desktop applications.)

Python also isn’t as well suited to traditional Windows applications, the form-heavy buttons-and-text-box designs that companies love to use in the business world. Yes, you can throw in a graphical user interface library like Tkinter, and then you can hunt for a tool that lets you design windows by hand, like Glade, but nothing about the process feels modern or easy.

Where to get it: https://www.python.org

2. JavaScript (or TypeScript)

Good news: Unmatched reach. Possibly the world’s most popular language, and its syntax resembles many other popular languages, like Java and C.

Pain points: Ignores errors, tolerates bad habits, and has plenty of quirks. Weak support for object-oriented programming. You also need to know HTML.

The beginning of a simple maze game in JavaScript

In some respects, JavaScript is a terrible first language. If you try to write even the simplest JavaScript-powered web page using a text editor and a web browser, you’re in for a rude surprise. The text editor won’t catch any problems — not even massive syntax errors that spell instant doom. And JavaScript is notoriously weak willed, ignoring even the most obvious problems until your program goes off the rails.

But JavaScript also has a benefit no other programming language can match. It’s everywhere, running on virtually every web browser and web-connected device in the world. If you create a JavaScript program, it’s almost trivially easy to put it online (and if you don’t have a web hosting account, you can do it for free on GitHub). There are no extra requirements, deployment headaches, or compatibility problems.

JavaScript also has serious practical value for real-world development. By many measures, it’s the most popular programming language in the world. It’s also syntactically similar to several other curly brace languages that you might want to try out in the future, including Java and C#.

So is there a way to bridge that gap between a language with infinite reach and an all-bets-are-off coding nightmare with no guardrails for beginner programmers?

The short answer is yes. With the help of the free tool Visual Studio Code, you can can catch the sort of errors that other programming languages would spot, but JavaScript usually ignores. Technically, this works because Visual Studio Code borrows the type safety from a more modern flavor of JavaScript, called TypeScript. The end result is a safer environment for beginners.

No matter how good your development tool is, it can’t cure all the headaches of JavaScript. You still need to learn HTML. You still need to use the clunky DOM (Document Object Model) to interact with your page. There are plenty of strange quirks and historical leftovers lurking in the language. And the nicest way to describe JavaScript’s object-oriented features is to say they’re patched on like an afterthought. But with Visual Studio Code, you can make JavaScript into a workable first language for beginners, especially if they’re older teens or adults.

Where to get it: Every web browser supports JavaScript, but you can get Visual Studio Code at https://code.visualstudio.com

3. Scratch

Good news: Provides a frustration-free way to learn coding concepts for younger children, especially if they haven’t yet learned to type.

Pain points: Often encourages scripting rather than real programming. Scratch creations are limited to the Scratch environment.

Part of a simple excuse-generator written in Scratch

Scratch is the only language in this article that isn’t a professional tool. It’s an outlier — a simplified programming environment for kids that doesn’t have the capabilities or the reach of the other options.

However, Scratch fills an important gap. It’s the best choice for young children who aren’t solid typists. With Scratch, kids create code by dragging different blocks onto a canvas. All the familiar ingredients are there — variables, conditions, loops — but there’s no need to worry about typing every statement perfectly.

Many Scratch fans promote it as the best learning-to-code tool for any age. In my experience, it’s a great starting point for younger children, but not as rewarding for teens and older beginners. Young Scratch-ers often use the platform to script stories, making programs that are a bit like PowerPoint presentations or old-school Flash animations. Lots of time is spent making drawings. And, too often, getting the result you want seems like a matter of finding the right prebuilt block rather than creating a solution yourself. But as a introduction to programming concepts for young children, Scratch is still leagues ahead of the code-themed games that you find on sites like Hour of Code.

Where to get it: https://scratch.mit.edu

Runner-up: If you love Minecraft, you can learn to code by hacking the game using Microsoft Make Code, which uses a similar building-block code designer.

An alternative: C#

Good news: A professional language that stays friendly. Skills transfer to other curly brace languages. Particularly strong for business development.

Pain points: You can create desktop applications easily, but they’ll be locked into Windows. Can be intimidating.

The beginning of a simple bomb-catching game in C#

C# has an undeserved reputation for being complicated. Most of the headaches are in other versions of the language. Start with plain vanilla C, and it’s up to you to implement a lot of basic features. Try something like C++, and you’re responsible for all the complexities of pointers and memory management. And don’t even ask about Objective-C, the odd flavor of C you use to write programs for MacOS and Apple devices.

C#, on the other hand, is a modern language stocked with conveniences and equipped with enough guardrails to keep beginners safe. From a language learning point of view, it’s almost exactly as easy (or difficult) to learn as Java. Empty applications tend to start with a fair bit of boilerplate. Even a simple command-line application won’t start with a single line of code — instead, you’ll get a whack of namespace imports and class definitions. And if you’re writing a Windows program or using one of Microsoft’s database frameworks, you’ll end up with piles of generated code in your project.

If that doesn’t bother you, you’ll find that C# is a comfortable place to be. It’s hard to think of another tool that allows you to build such a wide range of applications — anything from a low-level Windows service to a massive web application. Technically, these goodies aren’t part of the C# language but the .NET Framework, a massive toolkit of Microsoft-designed features and frameworks. When the .NET Framework first hit the scene nearly two decades ago, it was a closed Windows-only technology. Today, most of .NET is open source, and everything except the Windows-specific bits runs on MacOS and Linux.

C# isn’t the only .NET language, but it’s by far the most popular. You might wonder whether it’s worth considering VB.NET, the .NET version of Visual Basic. Although there’s nothing wrong with VB.NET, learning it isn’t much different — or easier — than learning C#. So if you’re going to put in the work learning a .NET language, you may as well learn the most popular one.

Where to get it: The best way to start with C# is through the free Visual Studio Community package at https://visualstudio.microsoft.com/vs/community

An alternative: Ruby

Good news: Thoughtfully designed language loved with clear syntax and natural integration of object-oriented programming concepts.

Pain points: Seldom used for desktop applications. For web applications, you need to use Ruby on Rails, which introduces new concepts and more complexity.

The beginning of a basic Pong game in Ruby

Ruby works an interesting magic. It’s a language purist’s language — elegant, refined, thoroughly integrated with object-oriented programming concepts — but it’s still an accessible starting point for new learners.

Ruby follows a philosophy called POLA, for the Principle Of Least Astonishment. It means that the language is designed (wherever possible) to avoid confusing or surprising the people who use it. That means language features should seem natural, consistent, and easy to remember.

From a pure syntax point of view, Ruby is at least as friendly as Python. Fans call it “pure” and “beautiful,” words that are definitely never overheard in a JavaScript classroom. And something about the Ruby languages encourages teachers to turn to it again and again. The web is full of sites with online exercises for Ruby. The language even inspired a whimsical picture book about programming called “Hello, Ruby,” which set a Kickstarter record by raising hundreds of thousands of dollars.

The problem with Ruby is that it may provide the best language-learning experience, but it doesn’t offer the best application-building environment. Yes, you can build desktop applications with Ruby, but few people do. You can also build web applications using the very popular Ruby on Rails framework, but it’s not a great starting point for beginners. (To use Ruby on Rails successfully, you need to know HTML, understand the concepts of server-side web applications, and accept a fair bit of tool-based code generation. None of these details are a good fit for a first-time learner.) The bottom line is that you can still learn with Ruby, but most beginners will be lured away by the promise of Python or JavaScript.

Where to get it: Get Ruby at https://www.ruby-lang.org and Ruby on Rails at https://rubyonrails.org

The final word

When I created this list, I was tempted to include several more programming languages. If you’ve got your own favorite, or if you’ve taught a beginner a language that didn’t work out, drop your story in the comments down below!

There’s something to be said for choosing a language and diving in. Maybe your choice will pay off, and maybe you’ll need to switch gears. Either way, you’ll learn something by starting. It’s worth remembering that you (or your student) won’t stay with a first programming language forever. After all: