What language should you learn? And why isn’t it Python?
If you’re here, you’ve probably decided to learn how to code and need a little assistance on figuring out where to start. When asked previously about what language a learner should start with I used to say that I didn’t have a strong opinion. Lately, however, I realized I actually do have a strong opinion:
It’s Java.
Before anyone grabs their pitchforks and goes straight to the comments section, I do have reasons for this.
If you are truly just starting out, or even if you have dabbled a little bit in other languages, there is no better language to start with than Java. I make a lot of comparisons to Python and I just want to say that I don’t hate python - it’s just that I see people recommend python constantly as a beginner language and I worry it puts beginners in a box that they then have a hard time getting out of. So a lot of my comparisons revolve around Python and why I think Java is a better choice - to all you Python stans out there I apologize in advance
It’s easy to read.
No matter what language you start with, it is going to look like a bunch of nonsense until you learn a little bit of syntax. No language is truly understandable to any beginner. But with languages like Python and Java, the syntax won’t get in the way of the learning after a few hours of familiarity.
Java is basically the Python of the C family of languages. And yes, you can quote me on that.
It’s strongly and statically typed.
Each piece of data in a program has a “type” - for example, a variable could be an integer (whole number) or it could be a floating point number (a number with a decimal). These data types are really explicit in Java and are part of the learning process of the language. A strongly typed language means that the type of the data won’t change out from under your feet - once something says it’s an Integer, it’s an Integer for its entire life. Python is also a strongly typed language, but it’s also dynamically typed, which I think is confusing for people when they step away from python and look at other languages. A language that is dynamically typed has the types of variables checked at runtime, whereas a statically typed language has its variable types checked at compile time.
For example, in Java if I have a variable that I want to hold my name, I would set it up as so:
String myName; myName = "Taylor";
In Python, the equivalent might look like this:
var myName myName = 'Taylor'
Variables in python don’t need to declare what type they are because they just figure it out when the program runs. I think statically typed languages are easier for beginners to follow along and to debug because their types have to be explicitly stated. It also forces learners to learn and understand the difference between data types they might otherwise not pay attention to or deem unimportant.
It’s compiled.
The fact that Java is a compiled language makes you learn a lot more about how computers work than you would otherwise. You get extra points if you learn how to do all of it through the command line when starting out instead of through an IDE. Because working in file systems and flitting around locations in my computer has become second nature to me, it’s always jarring when I see someone not understanding what is happening in their project because they have not had the opportunity to dive in and really see how their computer works (at the file system level). So not only do I think you should learn Java, but I also think you should do so with just a text editor and your command line.
That might make me a masochist, but I truly believe it will pay dividends in your future as a developer.
It’s Object Oriented.
Learning an object oriented language will set you up to understand all the fundamentals you need to find success in any other language - interpreted, compiled, strongly typed, weakly typed, whatever! Being forced to understand objects in code is the third-hardest thing for beginners to learn, and if you do it as the first language you ever really learn, then everything after it will be that much easier.
No pointers. No memory management.
Understanding object oriented programming fundamentals is the 3rd hardest thing for beginners to grasp. The hardest thing is learning about pointers and the second hardest thing is learning how to handle memory in a program. If you start your journey with Java, you won’t have to worry about either of those things until you’re finally at a point where you feel confident enough to start learning C at which point these two concepts will swiftly bring you back down to earth.
It’s hard enough to set you up well, but easy enough to keep your momentum.
Learning to program is never going to be an easy task, but choosing a beginner-friendly language will help you to maintain your motivation. You can find tons of documentation and answers online, and no one concept or bug should get you so stumped and stuck you actually quit. That is different from wanting to quit, mind you. You’ll want to quit. And you’ll want to throw your computer out of a window. But you’ll get through it.
A lot of what I’ve talked about already does actually translate to Python as well, but Java is just that one step harder that makes it slightly more worth your time learning. Python might be easier to start with, but Java will give you a deeper understanding of how programming works. I advocate for Java as your first language because when it’s time for you to learn your second language, you will have a much easier path to walk than if you start with Python. Python will also seem like a walk in the park once you wrap your head around Java, so if you learn Java it’s basically like learning Python at the same time. And you can quote me on that, too.
I lied.
At the beginning of all this, I told you I was going to lie to you. And I did. And for that I am truly sorry. It is time for me to come clean. I said that Java is the best language to learn but in truth…
“The best language to learn is the language that keeps you going.”
Whatever language you pick, if it keeps you interested and motivated to keep learning, then it’s the perfect first language to learn. Programming is hard and it’s frustrating. Even after a decade of coding, I still have moments where I stare longingly out a window, wondering why I ever did this to myself.
I am fully biased toward Java as a first language because it’s the language I learned first. It has definitely helped me in the long run - I have yet to start a job where I already know the main programming language used at said job. I keep having to learn programming languages on the fly at work, and having the solid foundation that Java first provided me is something I never take for granted. But I only know the benefits of learning Java first because that’s what I did. I truly have no idea what, if anything, would be different if I learned Python first. Heck, I’m sure somebody reading this thinks I’m a total nincompoop for how little credit I’ve given to Python in this post.
And that’s alright. Whatever works for you, works for you. I am excited to see what you build.