The Different Programming Languages
This page discusses the different popular programming languages and help you choose one to learn. You shouldn’t worry too much about which language you choose, since the basic programming fundamentals are the same in each one. But you might as well pick the language that fits best with your goals. You can look at this chart to get an overall idea and read below to find out more about a language.
Higher Levels of Languages
As mentioned before, there are "medium" languages which are closer to the machine, and high-level languages that take care of more things automatically. Even within these high-level languages, some languages (such as Java and C#) are more optimized for the machine while other languages choose greater flexibility for the programmer.
Java and C#
Java and C# are two very similar programming languages that are well-optimized and have stricter rules to help prevent programming mistakes. Code in these languages need to be “compiled” into lower-level code before it runs, and all variables need to be “declared” with their name and type. They also enforce/encourage a methodology known as “object-oriented programming”, requiring all code to belong to an “object”.
People who program in these languages use an IDE to write their software in, which can provide various features to help with programming, such as auto-completion suggestions while they code, and automatic highlighting of certain errors. The rules in these languages will help you detect certain errors before you even run your code, which can be especially helpful when learning programming. However, Java or C# are not made for writing simple scripts, and they are not as popular for quickly creating dynamic websites.
Java vs. C#
Both languages are popular in large companies, large projects and in projects that need optimized code.
Java code does not get directly converted into machine code. Instead it runs on a "virtual machine" which can run on all sorts of different hardware. This lets Java fulfill their slogan of "Write once, run anywhere". Java was once intended for widespread use on web browsers, but that is less common and a very different language is used for that (JavaScript). It is used in regular desktop applications, but its most popular consumer use is for creating Android apps. In large companies it is used both internally and to power their websites. It is also commonly taught in colleges.
C# can be called "Microsoft's Java", but it also has features missing in Java. It does not yet support multiple platforms as well as Java does, but it does fit well with Microsoft's other offerings. If someone is within a Microsoft world anyways, it likely makes sense to use C# over Java. Microsoft has started to open-source C# and associated technologies, so support for other platforms will improve over time.
In summary, you should learn one of these languages if you:
- Want to program for a big company
- Want extra rules to help prevent errors
- Require very fast software for large projects
You should likely do C# if you'll just be doing things on Windows, but you should do Java if you want to make Android apps or are going to a college that does Java.
The Web
The "interpreted languages" are more flexible, and are probably a better choice for a beginner who doesn't care about the reasons mentioned above. Since they're popular on the web, I’ll quickly review how websites work before going through different languages. (For more information see Intro to Web Development.)
When you view a website, a central computer called a server sends you a web page through the internet. Sometimes, they just send a static page that was sitting there on the server, but on modern sites, the page is often dynamically created for you. That means some code was being run on the server (the “back-end”) to generate the page that it sent over to you. Websites can use any language on their back-end that is supported by their web host. The page that gets displayed is formatted in static HTML (a markup language), but it can contain JavaScript that runs in the browser which allow it to do many more things.
JavaScript
Since JavaScript runs in all browsers, it can be a good choice of language to learn. No installation is required, since it can immediately be tried out in the browser. JavaScript can be used for visual effects, but also for doing things without having to update the entire webpage. Modern web apps require JavaScript for many of their features. (For example, try loading Gmail without JavaScript.) JavaScript is also used in many web-related areas, such as creating browser extensions. It is often used for other areas that beginners might be interested in, such as creating AppScripts to work with Google Apps. If you are interested in doing any of these things, Javascript may be a good language to learn. However, Javascript has certain confusing parts, so if you’re not planning on using it for the above purposes, you can try a more elegant language such as Python.
PHP
PHP is a language built for creating dynamic web pages, and it runs on the server-side. Let’s say you just finished building a website without programming and now you want to be able to customize things further. You want to learn how to program the brains of the website, i.e. the back-end. A large number of websites and scripts are built using PHP, and web hosts often come with a list of one-click-install scripts. If you want to create a plugin for WordPress or work with the same script that runs Wikipedia, then PHP is for you. Practically all dynamic web hosts run PHP, and its very easy to get started with it. However, PHP has some issues, such as a messy syntax and certain inconsistencies and quirks. This means you should probably learn a different language if you just want to learn programming or you want to create an entirely new web app. However, PHP has improved over time, and if it fits your purposes, go ahead and learn it.
Python
If you just want an easy and elegant language to learn programming, Python is a good choice. Unlike PHP and Javascript, which are made for the web, Python is a general-purpose language that is often used outside of websites. Python aims to be very readable, so even a beginner could figure out what some simple Python code accomplishes. Python has the unusual feature of using indentation to mark different parts of code. This makes the code look less cluttered, but can sometimes cause issues when copying code. Python is a good choice to go with if you don’t have a specific goal that fits with one of the other languages.
Ruby
Ruby is similar to Python in many ways. It is a general-purpose language which is focused more on programmer productivity than running-time on a machine. This ‘slowness’ isn’t really an issue for most things a beginner will be building. Ruby has become popular in the last few years due to the website-building framework written in it – Ruby on Rails. Rails developed certain principles (such as “convention over configuration”) that let programmers built websites quickly. If you are interested in creating websites with Rails, then it obviously makes sense to learn some Ruby. While Rails can be used without that much Ruby knowledge, I think a beginner should first learn a simple language before taking on a complex framework.
Other Languages
The C language is the 'grandfather' of modern languages, and it (and C++) influenced many languages, especially Java and C#. Many lower-level systems (and language compilers themselves) are written in C, but a beginner should usually learn an easier higher-level language for creating applications.
Objective-C (which appeared in 1983) is Apple's variant of C for creating apps for Macs and iPhones. It still requires programmers to do certain things that modern languages take care of automatically. Apple recently came out with Swift, as an easier alternative to Objective-C. Swift offers various beginner-friendly features, such as playgrounds for seeing your code execute live. Swift is a good choice if you're interested in creating iPhone apps.
The table below provides some additional info about each language. See this post for sample code for each language.
Scroll table sideways to view all languages.
Java | C# | Swift | Python | Ruby | JavaScript | PHP | |
---|---|---|---|---|---|---|---|
About name & original purpose | Named for Java Coffee, created for interactive TV | Named after C++ and the musical note. Microsoft's Java competitor | Implies faster coding, "Objective-C without the C" |
Named for Monty Python, created as a scripting language to bridge the gap between the shell and C | Named for the gemstone, created as a true object-oriented scripting language | Named after Java as a marketing ploy, created as a scripting language for Netscape browser in 10 days | Creator made it for his own Personal Home Page and it evolved from there |
Appeared | 1995 | 2000 | 2014 | 1991 | 1995 | 1995 | 1995 |
Language Principles (official or otherwise) |
Robust to catch errors Secure Portable to run anywhere High performance Multithreading for concurrency Dynamic (See Design Goals of the Java) |
Strong type checking Robust & durable Programmer productivity Source code portability and programmer portability Internationalization Run on hosted and embedded systems, distributed environments, large to small |
Builds on the best of C and Objective-C, without the constraints of C compatibility. Systems programming language that is as expressive and enjoyable as a scripting language. Modern, functional, easy to experiment with, safe and powerful. |
Readability counts. Explicit is better than implicit. Flat is better than nested. Sparse is better than dense. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. There should be one - and preferably only one - obvious way to do it. If the implementation is hard to explain, it's a bad idea. |
Make programmers happy Principle of least surprise There's more than one way to do it Concise and succinct Helps get the job done We are the masters, computers are the slaves |
Scheme-like language using Java-syntax. HTML needed a 'scripting language', a programming language that was easy to use by amateurs and novices, where the code could be written directly in source form as part of the Web page markup. We aimed to provide a "glue language" for the Web designers and part time programmers who were building Web content from components such as images, plugins, and Java applets. |
"I have absolutely no idea how to write a programming language, I just kept adding the next logical step on the way." PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly. |
Used for creating | Android apps, large websites | Windows apps, large websites (Unity games) | iPhone and Mac apps | Math scripts, wesbites | Ruby on Rails websites | Anything that runs in a browser (and beyond) | Applications built on older scripts like Wordpress |
Used especially by | Large companies (Banks, eCommerce, Google, etc.) |
Large companies (Microsoft, healthcare, etc.) |
iPhone developers | Academics, startups, Google | Startups (Airbnb, Github, Scribd, etc.) |
All websites | Older companies, Facebook. |
Pro / Unique Feature | Well-optimized Java Virtual Machine for running code. | LINQ for easily querying and updating data. | Easy to try out code with Interactive Playgrounds and REPL. | List comprehensions for creating lists based on other lists. | Pass around Blocks of code to get stuff done concisely. | Only language that runs in browser. | Quick to set up server and web host. |
Cons / Tradeoffs | Strict rules help catch errors but reduce flexibility and brevity. Requires more boilerplate code than others. Primitives. | Similar to Java. Integrates well with Windows, but not yet as well with other platforms. | May be harder to find answers when coding in a new language. Still has some issues with performance and bugs. | Somewhat slow. Using whitespace looks nice, but may cause occasional issues. Language split between Python 2 and 3. | Slower run-time on a computer. Multiple ways to do things can make reading code a little harder. | Its flexibility sometimes leads to inconsistencies, bugs or surprises. E.g. there's one global namespace for all code. | Messy syntax and some inconsistencies and quirks. Makes it easy to create something quickly, but also to follow bad practices and leave security holes. |
How language is executed | Compiled to run on the Java Virtual Machine so you can "Write once, run anywhere". | Compiled to run on the Common Language Infrastructure (part of .NET platform) which is primarily used on Windows but will become more cross-platform. | Compile to run apps on the Mac and iPhone. | Commonly executed on CPython, the official Python implementation written in C. | Commonly executed on MRI, the official Ruby implementation written in C. | Runs within any browser from source code; well-optimized for a scripting language. | Commonly executed on the official Zend PHP implementation. Facebook's newer HHVM compiler can execute PHP faster. |
Jobs (Indeed, AngelList) |
14,800 900 (Android: 800) |
3,340 150 |
105 150 |
1,650 1,120 |
1,505 340 (Rails: 1,020) |
2,070 for both | 2,400 690 |
Top Web Framework | Spring MVC | ASP.NET MVC | n/a | Django | Ruby on Rails | Node.js for server, many for front-end | Laravel, etc. |
Challenge
Just out of curiosity, what language are you planning on learning?
Please sign in or sign up to submit answers.
Alternatively, you can try out Learneroo before signing up.