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:
- 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.
- 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.
- 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.
- 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
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.
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.
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.