The beginner’s dilemma: Should I learn Java or Python?

The beginner’s dilemma: Should I learn Java or Python?

Image for post

We often find ourselves with a decision to make whose impact is going to be long-lasting and is going to shape us in many ways. This is one of them.

First of all, remember, all languages are essentially the same, and all languages can more or less do the same thing in some way or the other. Choosing a language isn?t about it being easy or hard, it?s about how you see coding as a whole. If you?re happy coding, you?ll see it positively and won?t be afraid to try new things. However, a bad language can set you up for hating the construct of programming in general.

So coming to Java and Python, the difference between the two couldn’t be more visible. Most people who are starting out with code get really impressed seeing python code for the first time, and for obvious reasons.

Here?s how printing ?Hello World? looks like in Java:

Here?s the same in Python:

Right off the bat you can see the difference between them, Python conveys the steps in a more readable format, drawing a lot of interest because of it. But that?s not the complete story. Small code snippets are fine, but real world code needs to be taken into account. Java isn?t the world?s most widely used coding language for no reason.

Advantages of Java

  1. Java is verbose, readable and structured well. Larger amounts of code are much easier to read in Java.
  2. Java is widely used in a lot of platforms: Android apps (Mobile), Server backends, Desktop applications (Java FX), so learning Java is a stepping stone to any of these. (Note: 1) Earlier applets were written for browsers with Java but these are now considered obselete. 2) Android also allows Kotlin as a language but it is still a JVM based implementation.)
  3. A wide range of libraries and frameworks for adding new functionality to your app or program.

Disadvantages of Java

  1. Developers are starting to favour other languages over Java (Kotlin over Java in Android for example) and hence is leading to a fall in Java use.
  2. Even though the language added support for features like Futures, Streams and Lambdas it was slow to do so. Java recently switched over to a 6-month release cycle, but it may be too late to bring developers back.
  3. Java usually has much more boilerplate code than Python.

Advantages of Python

  1. Very simple syntax compared to a plethora of languages out there.
  2. Widely used in Machine Learning, Deep Learning and the general overarching AI field. Very useful in data analysis and visualisation.
  3. Used in Web development with frameworks like Django.

Disadvantages of Python

  1. It is usually hard to go to languages like Java after doing Python whereas the leap from Java to Python is rather comfortable. Python abstracts core concepts from how programs work and prefers a logic first approach.
  2. Used in fewer platforms.
  3. Since Python is an interpreted language, it is slower than Java in most cases.

The Verdict

So the advantages are fine but what should you actually choose?

It depends. I?ll give a few pointers for you to choose:

If you?re just interested in programming and want to dip your feet in without going all the way, learn Python for its easier to learn syntax.

If you plan to pursue computer science/engineering, I would recommend Java first because it helps you understand the inner workings of programming as well. Doing python after Java would help you understand how it makes things easier.

If you plan on making mobile apps at any point, go for Java because Android needs Java and you can learn Swift rather easily after learning Java if you plan to go for iOS as well.

Make sure you go for the right resources while learning either of the two because that?s going to make the difference between you liking or disliking it.

Good luck.

?Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.?

-Linus Torvalds

16

No Responses

Write a response