Dynamically Typed vs Statically Typed Languages — From a Novice’s Perspective
This is really just Java vs Python
My first real programming language was Java and it will always have a soft spot in my heart, but I am fully aware of how counter intuitive it is for beginner’s.
At the university that I attend, the first year teaching language is Python and that’s what I’ve been programming in for the better part of this semester (with some SQLite and HTML/CSS/JS for personal projects). I disagree with a lot of what my school’s computer science curriculum focuses on (one of the reasons I’m only minoring in it, the other being calculus and I are not friends). I’d prefer JavaScript be the first language they teach, but Python is a great alternative. I’ll show you why:
‘Hello World’ script in Java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
‘Hello World’ in Python
def HelloWorld():
print('Hello World')
You can clearly see the difference.
Python is dynamically typed while Java is statically typed. This really means that the Python shell will check for bugs at runtime, while the Java Virtual Machine will check for bugs in the text. You can get away with a little bit more in Python, it’s easier to get things to run. Java takes a little bit more work, but you’ll have a great foundation in debugging.
Java and Python are both Object Oriented Programming (OOP) languages, but Java can not hide its OOP-ness from you. There is so much going on in a simple piece of Java code that most beginner guides just say ‘don’t worry about what it is, just put it in the file’.
Python is a lot easier to get running out of the box and make something simple, I even found it easier to understand certain data types in Python over Java. Java has many applications that will entice a beginner — Android apps are made in Java and Java promises Write Once, Run Anywhere functionality (not necessarily true, but close enough).
I appreciate Java wholeheartedly, but I don’t necessarily enjoy working with it. I think it’s a good teaching language if you have a mentor and are really dedicated to getting a strong foundation. I didn’t have a mentor which made it a little bit more difficult to understand certain concepts, but I’m learning to take concepts and strategies from one language and move it to the other.
I think that if you want to teach yourself your first language, I would definitely go with a more dynamically typed language like Javascript, Python or Ruby. If you have the resources and/or the passion, a statically typed language can definitely be a fantastic foundation and set you up for success in your journey as a developer.