What Is Really the Best Programming Language to Start With?


Python. We think Python. Now, several of you probably just had a hernia. Everyone and their mother have strong opinions on which language is the best “first” language.

One of you:

What?! But JavaScript is the most popular language according to Stack Overflow’s 2017 Developer Survey!

Another one of you:

“No no — the TIOBE index has shown that Java is the most used language in 2017 and 2018. It’s everywhere in enterprise!”

Yet another:

“But Java is beginning to lose popularity! Learn something like Golang, which is beginning to explode and is now becoming the popular choice for REST microservices!”

And another:

“You can’t go wrong with classic C or C++. Fastest-performing languages. The Unreal Engine is built on [a bastardized version of] C++! Game design! Whoo!”

That one guy:

“Wordpress is a huge market. Learn PHP.”

Stop.

If a person is so new to programming that they had to ask this question, they probably don’t have the ability to consider all the points you’re tossing out.

They likely may not even know what it is they want to do. After all, “software” could describe anything. IoT? Games? Mobile apps? Web apps? Embedded? Cloud? Graphics? Operating systems? Crypto? From the viewpoint of a newb, all of it sounds awesome (maybe). And overwhelming.

What if they want to do graphics programming? Would you ever recommend JavaScript for that? No way!

As an educator, you have to realize what the end goal is and choose a path accordingly for people not currently equipped to choose.

According to freeCodeCamp’s 2017 New Coder Survey, the vast majority of people want to learn how to code for professional reasons.

This means most want to actually become software engineers, not just dink around on side projects.

Source: Glassdoor

On top of killer benefits and pay (see above), there are various job perks like remote work and contract positions not possible with most professions. Better yet, if you come up with a great idea for an app, you could just dive straight into prototyping it.

In order to best equip someone to become a good software engineer, they have to become good problem solvers. This means algorithms and data structures. This means good frameworks and approaches to breaking down complex problems. It means strong foundations and fundamentals.

Doesn’t matter what you’re doing. Web design, embedded design, etc. — top-notch code requires top-notch foundations.

Yeah, yeah. Great. You could teach all that with Java or C. Why Python?

For starters, Python is super simple.

If the goal is to teach methodologies and frameworks for problem-solving, you want to eliminate the concepts that aren’t as important at the start. What use is there in mentioning namespaces or generics when they don’t even know basic flow control yet?

You remember how to write a Hello World Java program?

1
2
3
4
5
public class Hello {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

Does any of this mean anything to a novice?

“Uh. Public? Class? Um. Static? Void? What is String[]?”

Freakin’ 104 keystrokes to type a program that prints “Hello World!”. Also, you’re literally thrust into several different concepts right at the bat:

  • Class access levels (e.g. public, protected, private?)
  • Method access levels (e.g. public, protected, private?)
  • Static keyword
  • Return values (and void)
  • Arrays (String[])
  • Method arguments and signatures

It’s overwhelming. And verbose.

And the worst part about most Java 101 courses is that, by necessity, you have to tell your learners, “Don’t worry about all this stuff for now. You’ll learn it later.”

I guess on the bright side, it’s simple enough to compile and run a Java program. Except when you have to explain why Java requires its filenames to match the class it contains. Also, wait ’til you have to explain library linking.

1
2
3
$ javac Hello.java
$ java Hello
Hello World!

What about C++?

1
2
3
4
5
6
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!";
return 0;
}

“Wait, this is even more confusing. What is ‘namespace std’? int? Return 0? Do the two arrows << literally suck that quote into the cout? Wait, what is cout?”

Again, fluff. Yes, namespaces and return values are important, but holy moly not for someone who’s literally just learning how to print a message.

I remember learning Objective-C for the first time as a middle schooler and I just could not understand the concept of “returning 0.” It means the program worked? Why? WTF?

And in hindsight, it was unimportant information. It was distracting.

Now, how do you run this program?

1
2
3
$ g++ hello.cpp
$ ./a.out
Hello, World!
Source: GIPHY

“./a.out?” What is G++?

Yay, now we have to talk about compilers and executables and default output files. Again, more crap you have to either explain that isn’t important yet, or gloss over.

What’s this same thing look like in Python?

1
print("Hello World!")

Oh. Huh. And to run it?

1
python hello.py

Well gee, whiz. That wasn’t hard. You probably wouldn’t even need to explain anything, and someone could deduce what’s happening.

But… but JavaScript is easy too!

1
console.log("Hello World!");

Okay, and how do you run this?

Uh… open in a browser? How do I run this in the browser? What is node?

Also, sure, JavaScript is easy to learn in some ways, but JavaScript has numerous paradigms and conventions that make it much different than other languages (prototyping, usage of “this”, array-like objects, event-driven programming, promises, etc…).

On the other hand, a vast majority of the principles you learn from Python can be applied to numerous other languages (C++, Java, C#, Ruby, Golang, etc.). You get more bang for your buck. Switching between languages afterward is largely a matter of syntax and advanced, language-specific features — much easier than having to unlearn certain habits and paradigms from JavaScript.

JavaScript altogether is a different beast. The only time we would encourage learning JavaScript first is if the person is 100% intending on being only a web developer.

To be fair, you could also do backend development using Node.js, but we’ve watched people struggle with picking up Java or Python after having started out in JavaScript, and it’s pretty brutal.

Also, Python’s syntax requires exact indentation.

You ever read Java code that looks like this?

1
2
3
4
5
6
7
8
9
public class Hubba{
int num;
public Hubba(int blah){num=blah;
}
public static void main(String[] args)
{
Hubba bubba = new Hubba(12);
System.out.println(bubba.num);
} }

This code is valid Java. It will compile and run.

It will also induce diarrhea.

With Python, bad indentation gets errors out the wazoo. Python essentially enforces a huge aspect of code style — indentation. It is never bad to force new coders to adopt good code style.

Now if only we could get people to put spaces between their operators.

Technically speaking, if you learn Golang and use the fmt package, then you could auto-format your code. But Golang isn’t exactly a newbie’s language. Most Go tutorials online assume you already know how to code (like this one and this one).

Also, newbies don’t know what linting is.

Where to get started w/ Python?

Source: GIPHY

Free:

Paid:

Caveats

1. We obviously have our own opinions on what order is the best order to teach things in.

We personally think it’s not as effective to thrust people into everything at once. You could take a bottom-up approach, where you start with teaching about the computer’s low levels and how everything runs. But people quickly become disinterested.

A lot of people get into programming because they want to make cool apps, build games, etc. Learning about the kernel and doing low-level programming isn’t a great way to start and maintain interest.

That being said, they still need to learn low-level programming to a small extent to be a well-rounded software engineer. So the solution? Start with the things they are interested in, and then slowly fold in the stuff that they may not care about but do need to know.

This approach is why we prefer Python — you can immediately get to learning the important core concepts of programming that apply everywhere without cramming the “boring” stuff down their throats from the start.

Compilers and parallel programming and threading and blah blah blah… that stuff can be folded in.

2. It also depends on whether people are interested in becoming all-around, well-rounded engineers.

There are some people who are, quite literally, only interested in designing UIs. In that case, we’d argue that it doesn’t make sense to cram any kind of information into them about, for example, assembly language.

To us, a well-rounded software engineer is a person who knows a lot of things about software in general, but may specialize in a certain thing. For example, you could be a senior Java developer who specializes in back-end microservices. But if asked questions about low-level multi-threading or MVVM or MVC architectures, they would still be able to answer.

We believe that the software engineering world would benefit from everyone being highly well-rounded software engineers. This includes UI developers, because it’s pretty irritating when they don’t understand the implication of massive JavaScript SPAs (Single-Page Applications) draining the crap out of phone batteries.

Just to reiterate, this article reflects our opinions. You’re welcome to disagree, but there’s no need to be offended or upset because someone else thinks differently than you.

If you want to teach your students JavaScript or Bash or Erlang first, knock yourself out. They’re your students, not ours. We don’t care.

Good luck, and happy coding.