Move from Python to Java. First impressions

Posted on Fri, 26 Aug 2016 in Java

I've added Java to my technology stack at work recently. We decided to do our new project using Spring Framework. For me it is a very interesting challenge, cause I've used Java only in my pet projects before. There are my very first impressions.

Actually, I don't want to compare Python and Java much. Java is more verbose and has static types. It's obvious. I'm more interested in comparing mind sets and environments for both languages.

First of all, Java is more sensitive to quality of software architecture and design. Python is more flexible and forgive you some negligences in design before your code become mess. In contrast, Java loses readability dramatically.

Second, I was shocked how enterprise grade Java is different from Java for game dev or mobile. Language is the same, but frameworks for enterprise one is much more complex. Now I understand that Django is a tiny framework.

There are a lot of "magic" in Spring. It's very difficult to start. Luckily we have someone who has knowledge how Spring and related frameworks work.

Of course, there are fields where Java beats Python: it's much easier to deploy or it has advanced tools like Maven or Gradle.

In conclusion, I want to say that Java is'n better or worse than Python. It's different. And It manage you to change your programming habits:

  • Change way to read code. In Java, method body less important to read than in Python, because a function declaration in Java more informative and solid. I don't say you shouldn't read method implementation. You should, but only then it is necessary.
  • Annotations in Java aren't equal to the decorators in Python. They look similar, but they work differently.
  • Java force you to use IDE feature more intensively. Relax. It's OK.
  • Read books. Effective Java must be in your top 3. Java frameworks like Spring much more complex and harder to understand than Python ones, but there are much higher quality materials to learn them.

I'm not 100% Java developer now. About half of my time I'm still programming in Python. I will write posts about both languages Python and Java.