Nov 30, 20157 min read

How you can learn to program: choosing a language

A non-definitive, totally subjective guide to choosing your first web development language

If you've read my story, you'll know how much learning how to program has changed my life. I've gone from working at a passionless job to working at one of the most competitive tech companies in the world doing something I greatly enjoy. If you've also been thinking about learning how to program, I'd like to devote a few posts to get you started.

Today's post is about selecting your first programming language to learn. Selecting languages and frameworks can always be a bit of a holy war, so I'll stress that this is a personal choice and these recommendations are based on my opinions and area of expertise, which is web development. If you're interested in mobile app development, games, systems programming, or something else, this post won't be nearly as useful to you.

So here's the thing about choosing a language:

It's really not a big deal

It honestly doesn't really matter which language you choose to start, so you shouldn't feel the need to hem and haw about it too much. A large majority of concepts that you learn are going to be applicable to other languages. Languages are also constantly evolving, so even the more specific features of one language may wind up making their way into another language in the future as well. That being said, you still have to pick one, so it's good to get at least a little guidance on how to do so.

Factors to consider

I'll elaborate more on all of these in the below section when I start talking about the languages, but here's what I look for when I evaluate a language:

  1. Tools — You shouldn't have to reinvent the wheel when you're writing code. You'll want to choose a language that offers well-tested tools, libraries, and frameworks that people are using on other live sites.
  2. Community — Somewhat related to the above, if no one is using it, no one will be releasing new tools or updating the old ones. Having a strong community also means people to answer your questions on StackOverflow or other Q&A sites.
  3. Getting started quickly — There's a lot of magic in being able to go through a short "Getting Started" tutorial and to immediately open your browser and see it render something cool you've created. Learning programming is hard work, and I believe it's important for a lot of people to be able to experience this magic before being sold on going down this path all the way. There are languages that are a real slog to get started in, and it's possible to optimize for this quality when selecting your first language.
  4. Syntax — Maybe a bit trivial compared to the other three factors listed here but I like languages that do a lot with few lines of code and are easy to read.

What I'd recommend

Out of all the languages I know and given these factors, here are the languages I'd recommend, in order. Note that it's been awhile since I've heavily worked with some of the non-Javascript languages so parts of what I say may be out of date now. I apologize especially if I've left your favorite framework(s) off these descriptions:

Javascript

If all my skills were erased today, and I had to choose how to specialize again, there's no question I would re-up in front-end development. I remember my decision to focus on front-end development was largely influenced by the fact that for now, web apps and websites all require HTML, CSS, and Javascript to render, so it would never be a waste to get super proficient at those three technologies. Now that Node.js exists, Javascript is also available on the server side, so you can build a rich, fully-functional website or web app using only a single language. If you're just starting out, you really can't go wrong with specializing in front-end. The job market for such skills has skyrocketed in the past few years and doesn't show any signs of stopping.

There's no shortage of well-supported tools for Javascript. Javascript has been dominating as the most commonly-used language on GitHub for the past few years. On the client side some of the most popular tools are ReactJS, AngularJS, and EmberJS, and on the server side you have ExpressJS.

Learning Javascript first is not without its issues, as there are some unique language features and quirks that you won't find in any of the other mainstream object-oriented languages. Concepts like prototypal inheritance and invocation context don't translate well from similar concepts in any other language. You can make a career out of only knowing Javascript, but I still think there is tremendous value in learning at least one other language at some point as well.

Python

Python is commonly thought of as offering a good balance between being explicit and concise. I would say it's the most easy-to-learn language on this list because of how explicit it is about everything it's doing, and its syntax is clean and easy-to-read. These qualities make it the tool of choice for teaching Computer Science many in university courses. The most popular frameworks that I know of are Django, Flask, and Pyramid.

Ruby

I want to put Ruby higher on this list because I like it so much, but I'm not sure I can. Syntactically it resonates the most with me because everything is designed for maximum conciseness. It abstracts away so many details to allow you to write code that resembles plain English. However, the dark magic involved in accomplishing this goal is a double-edged sword, as it can be incredibly difficult to understand what is wrong if something does go wrong. The implication for beginners is that 95% of the time when you do something in Ruby you'll be thinking "wow, that was incredibly easy", but the other 5% of the time you will be questioning all your life decisions. The other main criticism of Ruby is that it's slow, and many companies, most notably Twitter, have switched from Ruby to Java after Ruby's slowness could no longer be tolerated.

The framework Ruby on Rails dwarfs all other Ruby libraries in popularity (and used to be the frontrunner on GitHub until the Javascript revolution took hold). I don't think I've found a more robust set of tools that allowed me to integrate functionality trivially that it would've taken me weeks or months to implement and test otherwise. The above languages also have a strong set of tools, but the ease of use and the wide availability of the tools on Ruby are, in my opinion, second to none.

Java

I hesitated a bit in putting this here, but it earns a spot having been my first language. The reason I wanted to leave it off is because of it's not at all easy to get started using Java. Java is often the language of choice for Enterprise applications, and its reputation as being an extremely verbose language is well-deserved. The aspect that makes it a good beginner language is that it forces you to learn more about what's going on under the hood, such as compilation, static typing, and a bit of understanding about memory management. There is so much value in working with statically typed and compiled code that there are now tools in Javascript such as Typescript that allow developers to write in such a way.

I wouldn't recommend Java as a first language for most people, but if you want to come right out of the gate learning more of a foundational understanding of Computer Science, Java offers a good balance between some high-level abstraction and understanding what your computer is actually doing when you run a piece of code. Another perk is that basically all other languages geared towards web development will seem quite easy by comparison if and when you learn them!

Again, it's really not a big deal

Despite how long I spent talking about the pros and cons of the different languages here, I just wanted to stress that the most important thing is just to pick a language and to start creating something awesome. Start with really simple things that would be useful to you. For instance, my very first app was a Java flash card app to help my now-wife study for her GREs. Doing something that matters to you will help keep you motivated to finish your projects. In my next post, I'll sum up some of the resources that have helped me do that and will hopefully help you too.