Why should you learn Java before python?
When you start learning to code, you may want to start with Python because it is easy to learn, and there are many YouTubers and influencers who suggest learning Python instead of Java, C, or any language that is considered more complex than Python. I have nothing against Python – it was even my first programming language. However, there are many reasons why I suggest learning Java or C before Python.
Statically Typed Language vs. Dynamically Typed Language
Python is a dynamically typed language, which means you do not need to declare the data types of variables in your program. Why is this important? As a beginner, you should try to understand how programming works. You can write Python code without thinking about data types, and there are many things you won't need to worry about. However, I want you to understand how data types differ. When you declare a variable as an integer in other languages, you always know that your variable is an integer and what you can achieve with it.
On the other hand, Java is a statically typed language, which means you need to explicitly declare the variable data type. This will help you understand the use of different data types in programming. If you are starting to learn programming because you want to be a developer, then you must have a good foundation in these concepts.
Java Object-Oriented Concepts
Java's design revolves around OOP principles (classes, inheritance, encapsulation). Beginners must use classes even for simple programs, providing a clear framework for understanding OOP. While Python supports OOP, it also allows procedural coding, which might delay your mastery of these concepts. This can make you feel overwhelmed when you later switch to Java from Python.
Compile-Time Error Checking
When you write code in Java, you find red lines highlighting the errors because of Java's compiler. In Python, you get errors only while running the code, not while writing it.
Java's Virtual Machine (JVM)
Java's famous tagline is "Write once, run anywhere." This is because Java code compiles to Java bytecode, which then runs on the JVM installed on any machine. In Python, however, your code may need modifications to run on different platforms.
Final Thoughts
If you want to start with Python, you can do so if you're interested in Data Science and AI/ML. However, if you're interested in learning the core concepts of Computer Science, you should learn Java or even C to some extent. Regardless of what you choose, try to complete it. That will be my advice for today.
0 Comments