I’ve been asked this before; here’s AN answer:
it depends, but lots of the ones whose names you’ve heard (C, Java, PHP, JavaScript, Python…) are probably good, and in some senses, “programming is programming”: learning ANY language will help you with ALL languages. every language has its own quirks, for sure, and some have unusual syntax, and/or are built for a specific purpose, but in the end, if you’re interested in programming, you’re going to learn a LOT of languages, and each has something to teach you. which you pick first is kind of up to you, and what you want to do.
here are my opinions of the various languages I know. please note: I do a lot of miscellaneous coding on the side, mostly game development, but my day job is as a web developer and manager, so a lot of my opinions come from a web development point of view.
C/C++
you may have heard of “C-style languages”. these are languages that share a lot of syntax with C (and C++). C and C++ have been around for a long time, and have had an enormous impact on many languages that have come since. despite their age, these languages have not been left to languish and rot; they’ve been continuing to develop over the decades, and have many-many applications today.
C and C++ are “strongly-typed” languages. this means that you have to tell the language, explicitly, what kind of data you’re working with as you pass it around. “this is an integer”; “this is a string of characters”; etc. a lot of languages are strongly typed, and a lot aren’t (so-called “loosely”-typed); whether or not a language is strongly or loosely typed influences a lot about how you use the language, and each has pros and cons.
in my opinion, the strongest “secret” pro of a strongly-typed language is that it reduces programmer error, and increases the helpfulness of your IDE (Visual Studio, Eclipse, etc). if your IDE knows “this is an array of strings”, then it can give you a LOT of help when working on that piece of data in code, offering up inline drop-downs of available operations you can take on that data, etc.
one of the greatest weakness of a strongly-typed language that I encounter as a web developer is that JSON – one of the most-popular languages of the internet – is loosely-typed, and strongly-typed languages have a tough time dealing with loosely-typed data.
final note I have about C and C++: they are pretty “low-level” languages, in that the instructions you write (especially in C) translate to what your CPU actually does more closely than most (all?) of the other languages on this list. this relative “closeness” to the CPU grants additional performance and power. some of this power can create more programming hazards (pointers come to mind), but for these reasons, C and C++ are more popular in the hardware coding world than other languages. operating systems are written in C and C++; not in JavaScript.
C# and Java
C# and Java (no relation to JavaScript; more on this later) are both strongly-typed C-style languages that went HAM on “object-oriented” programming.
whether you think object-oriented programming is OBVIOUSLY better or worse than functional programming is a debate you can have with many people on the internet š both are used, both are incredibly useful, and the two can be used together. you’ll learn a lot by learning both approaches. C# provides many methods which support functional programming, but it is best-suited to object-oriented programming. I’m less familiar with Java, but I assume the same is true for it as well.
(“what exactly ARE object-oriented programming and functional programming?” is a question I’m not prepared to answer here. maybe another time.)
C#, as a Microsoft product, is very popular in Microsoft-y parts of the world, but it’s found use in a other interesting places, including Unity (a popular 3D game-making IDE) where it is the preferred language.
if you’re interested in making Android apps, Java is the preferred language in that world. (Apple prefers “objective C”, which I know basically nothing about, so cannot comment on.)
finally: Java was designed from the start to be cross-platform in a time when cross-platform was harder to do! as a result of this easy cross-platformness, desktop applications and games are sometimes written in Java, including Open Office, and Minecraft. I also just learned, while writing this article, that parts of Twitter are written in Java! C# started Windows-only, but became cross-platform with Xamarin/MonoDevelop. (also worth noting: C, C++, and all the other languages on this list are also cross-platform.)
just a quick public service announcement before we move on: Java has NOTHING to do with JavaScript. I mention this because…
JavaScript
JavaScript started as a little language for making web sites COOLER. it was named JavaScript because, at the time, Java was insanely popular, and JavaScript’s creators wanted a piece of that popularity pie. JavaScript has since EXPLODED in popularity, not just on the web, but everywhere. it can run web sites entirely (both back-end and front-end), you can make mobile apps with it, you can makes games with it (JavaScript is Unity’s second-preferred language, the most-recent versions of RPG Maker use JavaScript, and there are several JS/HTML5 frameworks for games), and you can even make desktop apps with it.
JavaScript is also well-known for JSON – JavaScript Object Notation – which is one of the most popular ways in which web applications and APIs communicate with one another. (XML is also up there, but it has long-since fallen out of favor in modern web apps, despite Microsoft’s insistence on continuing to push XML (Microsoft… why are you always so behind on web tech?))
(note: JSON is a very small subset of JavaScript; you don’t have to learn JavaScript to learn JSON, and you won’t learn JavaScript by learning JSON. if you do ANY coding for the web, regardless of language, you’ll probably pick up JSON along the way. almost every modern language either supports JSON out-of-the-box, or there’s a super-popular third-party library available for it.)
JavaScript is C-style, loosely-typed, and object-oriented, but despite it’s C-like appearance, JavaScript has some core features and behaviors that will seem SUPER WEIRD to people who learned a more “traditional” C-style language first.
finally, the odd history of JavaScript, and the wide-spread use and many applications that JavaScript has today means there are a lot of KINDS of JavaScript, and many ways to do things, many of which are wrong. this increases the learning curve of the language. if you’re developing for browsers, you HAVE to stick to what’s called “ES5”, a subset of JavaScript. even within just ES5, there are a lot of bad ways to do things, but actually, you probably don’t want to program in plain ol’ ES5 anyway, and instead learn a framework, like Angular (which runs on TypeScript, a superset of JavaScript created by Microsoft that’s strongly-typed, but “transpiles” into ES5 JavaScript so it can be used in browsers), or React/Redux (an invention of Facebook’s which runs on ES6, and which is also transpiled into ES5). and then there’s node.js, for running JavaScript server-side… and even though it’s terrible, there’s still a lot of jQuery in the world… and omg, mobile development and even desktop development in JavaScript are also things!
in short: JavaScript is a huge, complicated world, and it’s moving fast as people find new things to do with it.
but if you’re now feeling turned off and scared by JavaScript, don’t be! my recommendation would be to decide what you want to do with JavaScript, and learn the toolset that’s best for THAT job.
- do you want to make mobile apps? check out PhoneGap, and Ionic.
- do you want to make desktop apps? check out Electron.
- do you want to make games? check out Phaser, PixiJS, or maybe even Unity (although really, for Unity, you should be using C#).
- do you want to make websites? learn about MEAN stacks, SPAs (single-page applications), Angular, and React/Redux.
- do you need to maintain decade-old websites, or WordPress sites? learn jQuery, and look for a better job š (how’s that for a hot take?)
most (all?) of these frameworks have excellent “getting started” guides on their websites which will lead you through creating your first project with them.
PHP
PHP is still the undisputed king of server-side web development, though JavaScript and Python have been increasingly nibbling on that pie.
about three-quarters of all websites are running PHP, including Tumblr, Yahoo, Wikipedia, and Facebook (although it may be worth noting that Facebook engineers have said they’d love to get away from PHP).
PHP, like JavaScript, is C-style, loosely-typed, and object-oriented, but unlike JavaScript, PHP is more “traditional” in its approach, and in recent versions is offering more strongly-typed features to those who want to use them.
also like JavaScript, PHP has a long, and let’s say “rich” history, that can make parts of it confusing for new users: weird, old, inconsistent functions, and many features and ways of doing things you simply SHOULD NOT use. as with JavaScript, learning how to program PHP right can be hard.
to help learn PHP right, and since PHP’s main role today is for serving websites and web APIs, I’d recommend learning one of the popular web frameworks for PHP.
- for a traditional website, check out Symfony, Laravel, or maybe Drupal.
- for an API, there’s Symfony’s little brother Silex, Laravel’s little brother Lumen, and many other RESTful frameworks.
again, as with JavaScript, most (all?) of these frameworks have excellent “getting started” guides on their websites which will lead you through creating your first project with them.
I would strongly recommend AGAINST learning PHP via an archaic framework such as WordPress or Media Wiki. these are incredibly popular websites you’ve probably heard about, but they are based on very old code that teach bad practices rife with security flaws and performance problems. you will honestly be doing yourself a disservice by learning PHP this way, not only by learning bad habits, but also by NOT learning the design patterns used by more-modern frameworks.
Python
one of my weaknesses as a programmer is in not knowing Python. but I’ll tell you what I can.
Python, unlike everything else on this list, is NOT a C-style language. this isn’t a bad thing, and it does not mean that the language is lacking! all it means is that the syntax is one-of-a-kind. this might sound like it’ll make it harder to learn, or make what you learn in Python less-translatable to other languages, but I would argue that that’s not the case:
- as I mentioned earlier, JavaScript is a C-style language, but this LOOK can be deceiving, because it ACTS very different from other C-style languages in some super-important ways. similar syntax can sometimes make learning harder, rather than easier.
- you’re going to learn TONS of syntaxes, anyway. JSON, regular expressions, XML and HTML, CSS, MySQL and SQL… it’s not a problem. your brain is up to the task.
- Python is relatively unique in that indentation is REQUIRED. proper indentation is a great habit to learn early. it’s NOT required in C, C++, C#, Java, JavaScript, or PHP, but it should be. indentation increases the readability of your code, and is basically a requirement when doing any kind of collaborative work (like, for example, at a job).
as mentioned, Python IS used for web development (ex: Django), but the biggest reason to learn Python – in my mind – is to get into AI. if you’re interested in artificial intelligence, machine learning, and all that, Python is MILES ahead of JavaScript, PHP or C#. (I’ve heard that C/C++ and Java are also decent for AI.)
Others You May Have Heard Of
- Go. I know nothing about Go. I hear people have taken a liking to it recently? maybe google up some info yourself, and see what people are saying about it. (no relation to the ancient board game of the same name.)
- (My)SQL. SQL, and it’s variants, are languages that are used to talk to databases. you’re (almost?) never going to write a full program in SQL, but you MAY write bits of SQL as part of another program that talks to a database. it’s often preferable to use a third-party library to talk to a database, though (Dapper for C#, Doctrine or Eloquent for PHP…), so you can get by without knowing SQL. you will want to learn it eventually, but to start, I wouldn’t make it a priority, and instead focus on learning a bigger language while picking up SQL on the side.
- HTML & CSS. using a web framework like Symfony, or even a JS framework like Angular, doesn’t mean you won’t use HTML and CSS! if you program for the web (or even for the desktop with something like Electron), you WILL use them! you will have to learn them. fortunately, HTML and CSS are relatively easy to pick up. chances are, you already know a bit of HTML, and I’m willing to bet you’ve encountered hex-coded colors (ex: #FF9900).
- Ruby. people were going NUTS about Ruby for a hot minute. that minute has passed.
- CoffeeScript. CoffeeScript – like TypeScript and ES6 – is not supported by browsers, but transpiles into ES5 JavaScript (the kind of JavaScript that browsers DO support). it was invented before ES6 was as popular as it is today, and it’s now much-preferred to write in ES6 rather than CoffeeScript.
- JSP. it’s Java, so you might think it’s good, but it’s not. back when it was worth talking about, PHP was still better; today, JSP is old, and rarely used.
- ASP. I like Microsoft – I like their OS, and their gaming console – but they just CAN’T seem to get it right with web-based technologies. their most-popular internet browser was IE6. IIS is miles behind Apache and nginx. ASP has always sucked; they tried again with ASP.NET Core, and failed again. I don’t know why they can’t figure out the internet, recently, but they can’t.
- Visual Basic. it was slightly exciting in the late 90s/early 2000s. anyone still developing in Visual Basic today is probably doing weird, Access database stuff. you don’t want to be part of that world. there’s a better life for you.