> HackerTyper Blog

How to Choose Your First Programming Language

If you're embarking on the great journey that is software development, you'll immediately be faced with what is arguably the hardest choice of them all: What programming language should I learn first?

Although this seems like a question that should have an obvious answer, it's actually a dilemma that perplexes software developers constantly. Experts are always wondering which language is best for a task or how the job market will change.

To this, I say: it doesn't matter (mostly).

Some programming languages succeed better at achieving specific tasks, but for the most part, they can all reach your end goal. Thus, we can reframe our question from "What language should I learn" to "What am I trying to build?"

Ultimately, in your programming journey, you will most likely want to learn additional languages, so your first programming language is merely a stepping stone. Moreover, being a good software developer is also about being "software agnostic;" when you truly understand how software works, you can be an expert in a single language yet have no problem with understanding others.

What are you building?

The following is a list of what I personally believe to be the optimal programming languages for each type of task. This is a fluid list, subject to change at any time, and should not be seen as an absolute truth.

Back-end for novice programmers

You will hear the term back-end mostly when people talk about the web stack, but the reality is that almost any app that needs to retain/process data has some sort of back-end. (However, you won't always be controlling it.) Back-end is a whole-encompassing term that contains the likes of: Database, APIs, Data processing etc...

This is where you have the most freedom in the language to choose, assuming you need a back-end at all–since any language that can run on a machine can act in some way as a server.

PHP: Build back-ends that get it done

PHP is my first choice to initially understand what is happening with a server and whip out some back-end logic ASAP. I don't think that back-end is where a novice will learn the most; therefore, a language that allows you to get up and running without giving you too many headaches is optimal.

With PHP, you won't be the coolest kid on the block, but you'll be shipping products while others are still setting up their dev environments.

PHP is a robust language with a stable ecosystem, a long history as a back-end language and a vast community that has been generating content for many years. You will not have any struggle in finding resources on how to do anything in PHP. This comes in handy, especially in your early programming days.

PHP is therefore a solid choice for your first programming language.

Python: Create back-ends without effort

Many people regard Python as the most beginner-friendly language due to its ease of use, clear syntax and welcoming community. Python has two great frameworks for making applications: Flask and Django.

Flask will allow you to easily create API in a concise and clear manner.

Django is an exceptionally powerful yet simple Framework that is more geared towards creating "full" websites, meaning you can also make your front-end with it. However, it can easily be stripped down to be only a "back-end" framework.

Python is also a strong contender for a first programming language.

# An example of Flask
from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World!"

if __name__ == "__main__":
    app.run(debug=True)

JavaScript: learn it once

If you want to get into Web Development, you will need to learn JavaScript for you front-end, so why not also use it for your back-end?

Node.js is a JavaScript runtime that allows you to run your JS code outside of the browser and can be used as a web server. The advantage here is clear: you need to only learn one language! The downside is that many developers have a love/hate relationship with JavaScript.

I think JavaScript is fine, but I never tend to suggest it as a beginner's language since it lacks a lot of the structures and functions that help really understand how programming works. Often, people that learn JavaScript end up ONLY learning JavaScript.

Note: JavaScript for the frontend and for the backend are similar, but make use of different libraries and have quite a few nuanced differences. Learning both at the same time can therefore lead to confusion, especially if you don't separate the two projects very distinctly.

Given this, Javascript may be a worthwhile choice for your first programming language.

Takeaway: What should I use for my back-end?

You can choose your back-end language freely.

If you want the easiest language: use Python.
If you want to immediately get stuff done: use PHP.
If you are making a website and don't want to learn another language: use JavaScript.

What programming languages are best for making websites?

Websites nowadays are made of three different pieces: HTML, CSS and JavaScript.

There are a few languages, such as TypeScript, that you could learn instead of JavaScript, but considering it's a superset of it, and it's transpiled to JavaScript anyways, I would not recommend to start with it. The same goes for others like SASS to replace CSS.

HTML, CSS and JavaScript are all equally essential to creating websites, so they should be learnt together at the same time. It's important to view them as a single bundle instead of three different things. The three work in sync between them; you can even have CSS/JS in the HTML and you can have HTML/CSS in the JS.

HTML and CSS are absolutely mandatory to make even a basic website from the ground up. You could get away without learning much JS, but if at some point you want to add any interactivity, you'll need to either use snippets that you don't understand, or put some effort into learning it.

Takeaway: Learn HTML, CSS and JavaScript

Ultimately, if you want to make websites, you have to learn all three.

Learn HTML, CSS and JavaScript together at the same time if your goal is to make websites. Your first programming languages will therefore include all three of these languges.

Beginner programming languages for Apps

The best language to make iOS Apps: Objective-C or Swift?

If you are looking to create native apps for iOS you will have two choices, Objective-C or Swift.

Objective-C is an old language (first appeared in 1984) and it shows. Like most of the languages that have been around for a few decades, it is robust but carries a lot of "baggage" that nowadays could be considered excessive.

Swift is Apple's response to create a modern language and it is successful for now. Swift has been well-received by the community and is generally regarded as a good language. Therefore, I don't feel bad suggesting it as a go-to for beginners interested in making native iOS apps.

If your goal is to make iOS Apps, go with Swift as your first programming language.

// Example of Objective-C
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]){
    @autoreleasepool{
        NSLog(@"Hello World Objective-C");
    }
    return 0;
}

What language is best to use for native Android Apps?

Android apps follow a very similar pattern to iOS. Google initially made Java the main language to be used for making native apps. However, due to "reasons" Google began pushing a shift towards a younger language called Kotlin, developed by JetBrains (whom also make the Android Studio IDE)

I worked a lot with Java and I grew to be very fond of it. It's not without defects, but some of those defects are precisely what make it a great beginner's language. Its verbosity and statically-typed nature make it very obvious when you make mistakes, forcing junior developers to learn to write good, idiomatic code.

That said, Kotlin is intended to fully interpolate with Java. You can even use files written in these two different languages in Kotlin projects. Consequently, you can take advantage of the amazing plethora of libraries that are already available for Java in Kotlin and it follows very similar principles.

Ultimately, this makes Kotlin an incredibly unique language and a win-win situation!

Kotlin is therefore recommendeded as a great first programming language if you want to build native Android Apps.

Programming native Desktop Apps

Desktop apps nowadays are in a very weird space.

On one hand, the best way of creating native apps is still to use native frameworks. This means using Swift/Objective-C for MacOS or C# on Windows. However, the advantages of using such languages start to strongly diminish once you want to create a cross-platform app. Maintaining different Apps for different platforms is already prohibitively expensive, and on a Desktop environment where you want to have a consistent experience between platforms, it might be better to look at languages that allow you to create a single app for multiple systems.

This can be achieved with JavaScript, thanks to Electron, you can create an application that will be able to run comfortably on Windows, Mac and even Linux systems with minimal to no adjustments! There are drawbacks to consider, including the fact that bundle sizes are huge and performance is not top-notch, but as cross-platform desktop apps become more and more popular, those drawbacks are mitigated easily.

Takeaway: You probably want to learn JavaScript if you are building a Desktop App

Unless you want to specifically create an app that is targeting a single OS and want to take full advantage of the functionality of that OS, choose JavaScript.

Choose a programming language and commit

The world of Software Development is one of choices and tradeoffs.

Nothing comes for free, but fear not: you are not alone in your choices! All the languages listed here offer incredible communities of people that will support you in whichever path you decide to take.

And on top of that, should you decide to change midway, nothing is wasted. Whatever you learn while developing in one language on a platform is not lost; the underlying programming knowledge will transfer to the next one.

The most important thing to do now is:

  1. decide what you are trying to build and then
  2. pick a programming language and begin

The rest will follow!