Which Programming Language Should I Learn First?

Dear Lifehacker,
With all the buzz about learning to code, I’ve decided to give it a try. The problem is, I’m not sure where to start. What’s the best programming language for a beginner like me?

Could-Be Coder

Dear Could-Be,
That’s probably one of the most popular questions from first-time learners, and it’s something that educators debate as well. The thing is, you can ask ten programmers what the best language is to get your feet wet with and you could get ten different answers—there are thousands of options. Which language you start with depends not only on how beginner-friendly it is, though, but also the kind of projects you want to work on, why you’re interested in coding in the first place, and perhaps also whether you’re thinking of doing this for a living. Here are some considerations and suggestions to help you decide.

Why Do You Want to Learn to Code?

Depending on what it is you want to make or do, your choice might already be made up for you. To build a website or webapp, for example, you should learn HTML and CSS, along with JavaScript and perhaps PHP for interactivity. If your focus is mostly/only on building a mobile app, then you can dive right intolearning Objective-C for iOS apps or how to program with Java for Android (and other things).

If you’re looking to go beyond one specific project or specialty, though, or want to learn a bunch of languages, it’s best to start with learning the basic concepts of programming and how to “think like a coder.” That way, no matter what your first programming language, you can apply those skills towards learning a new one (maybe in as little as 21 minutes). Even kids’ coding apps can be useful to start with. For example, the first formal programming course I took (well, other than BASIC back in fourth grade) was Harvard’s CS50, which you can take for free. Professor Malan starts the course off with Scratch, a drag-and-drop programming environment built for kids that teaches coding basics and logic—while helping you create something cool—and then he proceeds to teach you C.

We’ve featured several other excellent resources for learning to code over the years, such as interactive course Codecademy, but even with those you still need to choose which language to start with. So let’s take a look at the differences between the more popular ones and which are most recommended as a starter language.

The Most-Often Recommended Programming Languages for Beginners

Most of the “mainstream” programming languages—such as C, Java, C#, Perl, Ruby, and Python—can do the same—or nearly the same—tasks as the others. Java, for example, works cross-platform and is used for web apps and applets, but Ruby also can do large web apps and Python apps similarly run on Linux and Windows. SOA World points out that because many languages are modeled after each other, the syntax or structure of working on them is often nearly identical, so learning one often helps with learning the others. For example, to print “Hello World,” Java and C# are syntactically similar just as Perl and Python are:

Which Programming Language Should I Learn First?

They differ, however, in how easy they are to set up and get into. SOA World continues:

Hey, by the way, if you looked closely at those examples, you’ll notice some are simple, others are complex, and some require semicolons at the ends of lines while others don’t. If you’re just getting started in programming, sometimes it’s best to choose languages without many syntactical (or logical) rules because it allows the language to “Get out of its own way”. If you’ve tried one language and really struggled with it, try a simpler one!

Here’s a quick comparison of the most popular programming languages:

C: Trains You to Write Efficient Code

C is one of, if not the, most widely used programming languages. There are a few reasons for this. As noted programmer and writer Joel Spolsky says, C is to programming as learning basic anatomy is to a medical doctor. C is a “machine level” language, so you’ll learn how a program interacts with the hardware and learn the fundamentals of programming at the lowest—hardware—level (C is the foundation for Linux/GNU). You learn things like debugging programs, memory management, and how computers work that you don’t get from higher level languages like Java—all while prepping you to code efficiently for other languages. C is the “grandfather” of many other higher level languages, including Java, C#, and JavaScript.

That said, coding in C is stricter and has a steeper learning curve than other languages, and if you’re not planning on working on programs that interface with the hardware (tap into device drivers, for example, or operating system extensions), learning C will add to your education time, perhaps unnecessarily. Stack Overflow has a good discussion on C versus Java as a first language, with most people pointing towards C. However, personally, although I’m glad I was exposed to C, I don’t think it’s a very beginner-friendly language. It’ll teach you discipline, but you’ll have to learn an awful lot before you can make anything useful. Also, because it’s so strict you might end up frustrated like this:

Which Programming Language Should I Learn First?

Java: One of the Most Practical Languages to Learn

Java is the second most popular programming language, and it’s the language taught in Stanford’s renowned (and free) Intro to CS programming course. Java enforces solid Object Oriented principles (OOP) that are used in modern languages including C++, Perl, Python, and PHP. Once you’ve learned Java, you can learn other OOP languages pretty easily.

Java has the advantage of a long history of usage. There are lots of “boilerplate” examples, it’s been taught for decades, and it’s widely used for many purposes (including Android app development), so it’s a very practical language to learn. You won’t get machine-level control, as you would with C, but you’ll be able to access/manipulate the most important computer parts like the filesystem, graphics, and sound for any fairly sophisticated and modern program—that can run on any operating system.

Python: Fun and Easy to Learn

Many people recommend Python as the best beginner language because of its simplicity yet great capabilities. The code is easy to read and enforces good programming style (like indenting), without being overly strict about syntax (things like remembering to add a semicolon at the end of each line). Patrick Jordan at Ariel Computing compared the time it takes to write a simple script in various languages (BASIC, C, J, Java, and Python) and determined that while the other languages shouldn’t be ignored, Python:

requires less time, less lines of code, and less concepts to be taught to reach a given goal. […] Finally programming in Python is fun! Fun and frequent success breed confidence and interest in the student, who is then better placed to continue learning to program.

SOA says Python is an absolute must for beginners who want to get their feet wet with Linux (or are already familiar with Linux). Python’s popularity is also rising quickly today thanks to wide adoption on popular websites like Pinterest and Instagram.

JavaScript: For Jumping Right in and Building Websites

JavaScript (of little relation to Java) requires the least amount of set up to get started with, since it’s already built into web browsers. O’Reilly Mediarecommends you start with JavaScript because it has a relatively forgiving syntax (you can code loosely in JavaScript), you see immediate results from your code, and you don’t need a lot of tools. In our own Learn to Code night school we use JavaScript to show you the basics like how variables and functions work. If you want to make cool interactive things for the web, JavaScript is a must-have skill.

Choosing Your Path

One last consideration is whether or not you might want to go from coding as a hobby to doing it as a career. Dev/Code/Hack breaks down the different job roles and the skills you should pick up for them:

Back-end/Server-side Programmer: Usually uses one of the following: Python, Ruby, PHP, Java or .Net. Has database knowledge. Possibly has some sysadmin knowledge.

Front-end/Client-side Programmer: HTML, CSS, JavaScript. Possibly has design skill.

Mobile Programmer: Objective-C or Java (for Android). HTML/CSS for mobile websites. Potentially has server-side knowledge.

3D Programmer/Game Programmer: C/C++, OpenGL, Animation. Possibly has good artistic skill.

High-Performance Programmer: C/C++, Java. May have background in mathematics or quantitative analysis.

In the end, though, there’s no one way to get started learning to code. The most important thing is to learn the fundamentals through “scratching your itch,” so to speak, with working on a problems you want to solve or something you want to build. As the programming is terrible blog says:

The first programming language you learn will likely be the hardest to learn. Picking something small and fun makes this less of a challenge and more of an adventure. It doesn’t really matter where you start as long as you keep going—keep writing code, keep reading code. Don’t forget to test it either. Once you have one language you’re happy with, picking up a new language is less of a feat, and you’ll pick up new skills on the way.

Once you’ve decided, previously mentioned Bento will suggest the resources you need and the courses to take after you’ve learned your first language.


    • In high school we learned Turbo Pascal and I really enjoyed it. We had a whole project about programming an ascii animation which really made me wish that I had a computer at home so I could later try to program a super simplistic Tetris game.

    • In college, one of my first year classes was basic programming done in Pascal, but they switched to C/C++ this year, thankfully. Trying to compile something written in Pascal on a 64-bit OS is quite the chore, since Turbo Pascal only supports up to 32-bit Windows.

    • More interest in Pascal than I expected!

      Personally, I always like Pascal: You could do C-ish things in Pascal – but the nature of Pascal forced you to organize your thoughts in ways that C didn’t. A co-worker once wrote a quick-and-dirty utility in C that I ended up debugging later; it would occasionally crash due to strange pointer problems that weren’t obvious to find. After digging through the spaghetti code without success, I gave up – and re-wrote the thing in Pascal. No more crashes – and the code was far more maintainable.

  • Having taught and TAed way too many programming courses, I vote for starting with scratch. People end up getting so bogged down in the syntax of whatever language that they don’t end up really getting the concepts down, so I like the inherently concepts first approach of using scratch.

    Also, learn Python if you’re in science/engineering/data ’cause it’s got awesome traction in most communities and has a huge ecosystem for doing stuff.

  • I would recommend starting with a scripting language (Perl, Ruby, Python, Powershell) rather than a programming language (C, Java, C++, C#, Objective C). The amount of setup you have to do to get basic stuff working in a scripting language is tiny compared to the work needed in a programming language.

    I would also say, that your first language is the hardest, but it’s important not to just learn one language. People who only learn one language tend to lack a deeper understanding of how their language works, because they’ve nothing to compare it against. I actually think Javascript is a great language to learn academically, because it’s very simple, when compared with a monster like Java.

  • I plan on teaching my kids the basics in C (variables, loops, etc) before moving them on to Java for OOP, multi-threading, etc.

    I think the feeling of having wasted your time can be avoided by having them switch tracks sooner.

  • Hmm.. All that and no love for C# in ‘Choose your path’. C# applications can run just about everywhere, from microwaves to enterprise servers and just about everything in between including Lego NXT. And with tools like Xamarin studio and Mono you can put .NET apps on iOS, mac, linux and windows. Unity 3D for that matter is all on board with C#.

    I’m not going to knock the other languages and say C# is the one language to rule them all. I know the others too. Salaries commensurate with experience so there’s no need to be a loyal, only to understand the right tool for the right job.

  • Conan! What is best in coding?

    To crush your typos, see them driven before you, and to hear the lamentation of the syntax checkers.

  • You should learn assembler first, because because. Somewhere around my office I have (on a floppy) the code for a reverse polish notation calculator done in assembler (by me, as an undergrad). That was fun.

    Whatever language you pick, do a small project (like the rpn calculator) which you can complete and actually use. The satisfaction of completing something will spur you on to try another project. Try to repeat your project again in other languages/platforms.

  • Obviously, depends very much on what you want to do. For me and countless other scientists, Matlab (ok, the hardcore geeks may call it not a programming language…) has been a huge help to process data and automate things which would have taken me ages to do by hand. It’s very easy to begin learning the basic concepts of programming without having to worry about every little detail (like declaring variables etc…)
    Also learning linux shell script is extremely powerful and lets you automate virtually anything. “Big” languages like Java and C++ are not suited as productivity tools, what you can do in thirty minutes with bash might take you a week to figure out in C+… In my opinion languages are only for professionals who have to provide a nice GUI for the client and worry about a program running 0.1s faster…

  • Picking the 1st language is a tough and contentious choice. I think this article and comments have many good suggestions including C#, Python, Ruby, and Java.

    What I want to recommend is the second language to learn: Javascript. Don’t make it your first, or you might end up with some major confusion when you’re moving to something else. You might also end up with some bad programming practices. But if you have a good foundation and learn Javascript the right way, it can be one of the most useful languages to know.

  • Python, because you do not need a compiler and it’s very VERY easy to run your programs and test.

    It’s why the Raspberry Pi foundation chose it to start kids with on programming.

  • I’ve used a lot of programming languages and I think C# is a good way to go if you don’t know what you want to do with your new found programming skills. With C# and .net you can program for just about anything with a single language.

  • I would definitely go with Python. It’s the easiest to set up, learn and test. Once you get the hang of it make the jump to java. I program in java and I love it. I’m a software engineer and at school I had to learn PASCAL, C, C++, C#, JAVA, Python, ADA, Erlang, Groovy and a few others. Having tried them all I choose java.

  • Guys, HTML and CSS are NOT programming languages. They are markup. They only describe how content is presented. HTML can’t really *do* anything. Saying “you can learn Java or JavaScript or HTML” like all three are interchangeable will just confuse beginners.

  • For context, I’ve been a UI/UX designer for the last 13 years, and for about 9-10 of those years, CSS/HTML as well, and the last 4 years, jQuery (Javascript framework/library).

    I’ve been wrestling with trying to learn a server-side language for awhile. After A LOT of quick samplings and research (over the past 3 years or so), I’ve settled on Python. For me, the syntax (i.e. the way the language is written) is the most readable and understandable without being TOO simplistic. Ruby, for instance, reads very organically as well, but to the point where you almost feel like you don’t know exactly what’s going on behind the scenes.

    For the longest time, PHP was a front runner, but by every programmers accounts, it’s messy. It’s quick to get up and running, and hack together code, but if your purpose is to learn well structured and planned applications, PHP has too many opportunities to “stray”.

    Javascript is becoming a much more viable option nowadays, with so many awesome frameworks being built on top of it. Node, jQuery, Appcelerator,e tc. etc. Nowadays, you can do the front end and back end all in javascript and just deploy.

    My best suggestion in getting started, is pick up 1 good book, but don’t bother reading it all perfectly. Start with a project in mind, make it simple and most importantly.. something YOU WOULD USE. Because at the end of the day, motivation will be your worst enemy. When you stay excited for a project, the learning comes without effort.

  • One option I’d suggest is TypeScript. (http://www.typescriptlang.org/)

    Typescript is very much like Javascript (in fact, a pure javascript program will compile cleanly with the TypeScript compiler). And the output of the compiler is Javascript.

    What TypeScript offers over Javascript, is a cleaner syntax, strong data typing, and true support for Object-Oriented programming (before someone complains — Javascript does not “support” OOP; it merely “allows” OOP through the abuse of an implementation detail. The JS code the compiler outputs abuses the same detail, but the input source code cleanly supports OOP)

    So, basically, It’s just like Javascript, but better, and (since the output is JS) can be used everywhere JS can be.

    The downsides are:

    It was created but Microsoft, so, despite being an Open-Source project (https://typescript.codeplex.com/), it must be evil.

    It adds a compile step between coding and running (compared to JS).

    It’s virtually unheard of outside of a niche area.

  • After struggling with Java for a year, I jumped off the deep end and learned Scheme, using MIT’s SICP book and lectures.

    While I can’t say it has been the most enjoyable experience (I was never that great at math to begin with), it really did teach me how computer programs work. It even helped me when going back to Java, and now with learning Haskell. If you have the patience, I think it’s well worth it.

  • Perl first, then Python, then Lisp. Perl teaches UNIX philosophy, Python teaches good practice, Lisp teaches logic and beauty. Nice Emacs screenshot, btw.

  • C and assembly as the fundamentals, and then everything else will be easy.

    Kind of like when you had to derive all those formulas in your early engineering classes, and then find out 3 classes later there a simplified way to do it. You get a better appreciation for it later.

  • C++ is my favorite language. However, is is a terrible language for a beginner because of the same reasons — you can do things extremely low-level. I suggest Python if the person wants to continue on to learn other languages, as HTML/JavaScript is wonderful for beginners, but very different from other languages in how they work.

  • Obviously, you need to learn a language to get started. But try to learn the principles behind the language and not JUST the language.

  • Simple: learn C first. You’ll learn a lot of low level CS basics. From there, I recommend C#, Ruby, and Python.

  • I learned HTML and CSS first with very basic Javascript. Then I got a very good understanding of JS and decided to stick with jQuery for most of my projects. Then I learned PHP and I wrote my own blog engine (great first project for PHP learners). I gotta learn Java next to start with Android, it’s already on my to-do list. Objective-C, sure, maybe a bit down the line though. I’m partial to Android.

  • It is also useful to note that Java is the language for AP Computer Science A and (on a smaller scale) IB Computer Science SL/HL. So, for those of you who are High School students, learning Java might allow you to take the AP exam or take the IB Computer Science course for college credit.

  • I like CoffeeScript, it’s JavaScript with nicer syntax. Think it should be well suited for beginners, too.

  • What – no love for embedded systems designers? ANSI C, all the way!

    In all seriousness, I’d start with an interpreted language like BASIC to learn the concepts of variables and loops. I then might do a simple PIC project in assembly, and then move on to C. Apps are OK and everything, but embedded systems are awesome! It’s cool to see your code run an engine or move an actuator. Now that I type this, I’d recommend checking out a local robotics club.

  • Omg, A question, I’ve been asking myself for a while and ready to get my hands dirty. What a really contructive answer to a question. Glad i found this site first. I go back in the day to windows 3.1 and basic. I do think a sicentific brain works. I look at various codes sometimes and just see it and how i can edit what is already infront of me. Think i’m guna hit C for disipline and have a go at python at the same time. Ulitmately just dipping my toe into linux and wana get a better understanding of the insides. Thank you….

    • No love for VB/VBA/VBScript? I started learning on VB and most people who use excel usually wind up in a situation where a little VBA could simplify their life. Most people I’ve seen trying to learn programming give up because they have no vested interest in the end product. A goal set by a book or teacher isn’t as motivating as a goal set for yourself.

      Also, a lot of industrial packages use VBA (in my experience at least).

    • That’s a good suggestion too, since Microsoft has a ton of tutorials and such. And, yeah, knowing VB is super useful if you work in Excel a lot.

    • Many of us spend at least a portion of the day using Office. VBA is THE tool to get anything done in there, and both the development environment and the platform are right there in front of you. Where better to start?

    • My son had a CS class in middle school that used VB. He could build GUIs that didn’t do anything, but he knew nothing about the underlying programming that would make it work. I had to teach him everything, that is, do the teacher’s job for him. I would have started with C, only because not everybody at that level has a computer that can run Perl scripts. You need to know what a for loop does (among other things) before you can make fancy GUI-based stuff.

      It would also have helped if the teacher had some CS background. I think he was a regular math teacher who got roped into teaching that course not having much idea what he was doing, perhaps hoping there was a student in the room who already knew how to code who could help him out.

    • Any language that feels right for the them. But if I was forced to choose, +1 for Python. It has a large set of libraries, it forces beginners in to good habits right from the beginning, and once they use the uber simple python dictionaries, they will give them a better understanding of hashtables in other languages.

    • I think you did a pretty good job of laying it out as an “it depends” type of scenario, because it really does depend on your goals. If you want gainful employment as quick as possible, I would recommend Java or C# (I lean towards C# but I’m biased).

    • It depends so much on what you want to do. HTML and CSS are beautiful artistic languages, but (aside from some html5 and css3) they’re mostly for static things. To make an app or website that does something you need PHP, Python, Jquery/Javascript, or one of the various other languages you mentioned. Mind you at some point you usually need a combination of HTML, CSS, and programming to make a real working program. It all depends on what you want to focus on and its usually a question of design vs programming.

    • I’m having to use JS/jQuery (which I usually use) less and less thanks to more developments in HTML5 and CSS3. There are still some very distinct situations where you’ll need JS though. Either way, if you want to be a programmer, HTML/CSS is not a good place to start. They are fairly easy to learn so it should be done later. I’d recommend starting with PHP and Javascript only because there is no setup required except either 1) a text editor an a browser to test locally, or 2) an FTP client, editor, and server to publish stuff.

    • I agree with you if its programming you want to learn. If they want to focus on design then HTML and CSS is the way to go. And you are right, they are incredibly easy to learn.

    • Also VB i think is the best (after css/html/php) to learn to program for “applications” or “apps”. It can be used to make Windows 8 apps and the skills can easily can be moved to C#, your foot in the door for other C languages

    • If there aren’t any time constraints, I’d say start with assembly and work your way up to higher-level languages. The depth of understanding you would have by the time you reached Java or even PHP or JavaScript would have you being an incredible programmer. It would be like being a civil engineer having a background in physics. You’d know more about the “why” underneath everything you do in your profession.

    • I believe that C, like the article describes would be the best place to start even though there may be a steep learning curve. It teaches you best practices, and you really learn ‘how’ the code works, instead of simply telling it to do something. Learning about pointers is a great start.

      From there, even if unrelated (OOP), most coding languages will be learned at a much more rapid pace than had you started somewhere else.

    • VB is technically dead since 2005, the new VB.net is just C# with some syntactic difference. I think MS is intent on fazing it out completely in the next few years.

This entry was posted in COMPUTING. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: