Java is my new Python

Hammad Qureshi
Bazaar Engineering
Published in
9 min readNov 9, 2021

After exciting years of software development in Python, I have now professionally switched to Java. This seems to be a controversial move particularly for a language chauvinist programmer. Wait wait don’t panic, I request to read the article completely and then come to any judgement. Because it was not a sudden accidental move. Rather it involved deep research and advise. Recently I have joined Pakistan’s fastest growing tech start-up Bazaar. As interesting my journey to Bazaar is, it at the same time is a purposeful story for the software community too. So I thought to put down my whole story in words so the community could share their thoughts and learn from what I have gone through. So before telling you guys my engagement with Java, let me first disclose how I met Python. To be very honest, my inception with Python was just a coincidence and trust me nothing happened as per my will. In fact in my university days, my perception was that Python is a language that no ‘Cheeta programmer’ used for the software development. Not sure for any specific reason but I think mainly due to the university’s curriculum alignment towards Java.

Actually it happened when I joined my first software company as an Android developer. For the few starting days I worked on Java (Android). Then due to some other project demands, I was forced to move to that Python project. Obviously an unfortunate incident it was to me because of my so called Python stereotype. However I had only two choices, either switch the company or keep working according to their will but with a new language i.e. Python for at least few days (that’s what it seemed to me at that time). Keeping this in my mind, I started working on Python sincerely. Time passed and I been keep working on Python. Eventually I forgot all the grievance and accepted Python by heart.

Python had all the features and charms that any programmer dream of.

Never again thought to switched from Python after then. Python honestly quickly made me in love with itself. Python had all the features and charms that every programmer dream of. Python is a scripting and interpreter language, which added up in my coding speed. No builds, no compilation just saved my much level of efforts as well as time. At the same time, the strong Python community never let me get stuck in any problem. If I ever had any such strange problem, the solution was just a question mile away from me. In the next coming years the companies I joined were all Python based and I was literally enjoying and loving my development using Python.

Then why switched?

Then time had came and I get an offer from Bazaar. Bazaar is the fastest growing technology startup in Pakistan, where the engineering culture and trends was quite popular among the local programmers community around. I wanted to be a part of such engineering culture that was developing the solution for the million compatriots. This was the first time honestly when I thought to switch from Python. Obviously, the decision was not that easy. On the one side I had my great love for Python and on the other side I had an opportunity from Bazaar.

The door of opportunity will open only when you decide to step outside the door of your comfort zone.

Where the reason like Python comfort zone, there were other reasons as well. My graduation is in software engineering and I been taught that programming language is nothing but just a tool that assists you in crafting great ‘software’ and so being programming language specific is in a way against my basic education. It is also important to mention here that I had already learnt Java in my university projects. So Java was not such very unique for me. It favored me actually in the decision to move to Java.

Wise men don’t need advise. Fools won’t take it — Benjamin Franklin

Nothing can sort your decision making more than a wise advise. Such wise advises helped me to understand that restricting on a single technology stack, could not make us learn as much as we can learn by switching our technology stacks. For example, if I won’t moved from Python and I would never get the practical pros and cons of the two rivals. For sure it helped me to properly understand the performance comparison of both languages.

General perceptions

As mentioned that the general perception of a software engineer is that one should never be language specific. It’s all about the basic software engineering components that are available in every programming language. These components are programmed together to create a software program. So a software program is just a set of instructions written together in a formal grammar called programming language. But as there is a famous saying, there is a big difference between saying and doing. So yes in this case too, there is a big difference between practically switching languages ​​and just saying. You will also get to see the advices of people who will not support you in terms of language switching. Maybe their approach is very practical and they think that if one stays with a single programming language it will be a good for their career.

A software program is just a set of instructions written together in a formal grammar called programming language.

Challenges of switching your programming language

Switching language will give you some challenges that you should be well aware of before making any switch decision. Here are few of the challenges I faced while switching from Python to Java.

  • Think with a new mind: So before you kick off your coding in Java you should be fully aware of the core differences between the two languages. Actually the core difference is their nature of execution, which actually derives all of their performance and speed metrics. Python is an interpreter language while java is a compiler language. This doesn’t mean that python code is not first converted to byte-code at compile time. The difference is the JIT compiler used by Java for converting it’s byte-code to machine code directly on runtime instead of doing it than before execution. Make yourself think that you now working in Java and thinking with the Java mind means to think and plan for Java not for Python.
  • Syntax Differences: A lot of syntax level differences exists between the two language. Python promotes it’s lesser line of pythonic approaches instead of repeating yourself again and again for the obvious things. Syntax differences at first will annoy you a bit but by the time you will become use to with the new syntax and could easily code without any pauses.
  • Coding Speed: Your coding speed will drastically be disturbed because you first have to look at the syntax documentation and then have to start implementation. This learn and implement phase would add some delays in your source releases. However this is just a temporary phase as your coding speed will gradually be increased as you keep your hands on the language.
  • Performance: Another strong point is that when you change your Programming Language, You probably don’t know the Performance factors of the new Language. In starting days you will write the code that could be way far from performance attributes.
  • Time: The only source of knowledge is experience and experience comes with time. On previous language you have spent your time, which in return gave you the knowledge. For the new language you again need a time to gain knowledge. So meeting the team expectations would be a challenge too.

The only source of knowledge is experience and experience comes with time — Albert Einstein

Controversial paragraph — Python vs Java

This is very controversial debate which language is better Python or java? In my opinion no single language is superior to another. Every language has it’s own advantages and disadvantages.

Python is an interpreter language and Java is a compiler language. This is a fundamental difference between the two. These fundamental differences give the language it pros and cons. Performance wise, the performance of Java is due to its just-in-time compiler. Java is also a multi-threaded (concurrency) language because of JIT’s capabilities. While Python is an interpreter language, so it basically a single-threaded language. Anyhow it’s a separate debate how Python then provide the multi-processing capabilities. The point here is that Java gives better performance in multi-threading because of its speed and performance, as opposed to Python. So when you move in Java, you will now get some fun benefits too, so you have to change your thinking in the same way.

At the time of program execution in Python, lint and syntax rectification could be checked. But if any issue is of runtime type then it will be known only at the time of that line executive. So This can risk operational breakdowns and extend turnaround time. In Python you have to put a lot of body in your unit tests. Unit tests can save you from such issues. Because of the build compilation in Java, such issues do not occur. Runtime issues will be identified before your byte-code can be generated.

Zen of Programming

I am always been a big fan of Zen of Python PEP20. The Zen of Python is to me a cause-and-effect principle that teaches you how to write a beautiful code. PEP20 mentions 19 different good coding principles that one should follow to write a beautiful code. Following these could make your code a true ‘beautiful code’. In previous companies where I used to work in Python, there during code reviews I often quote Zen of Python for any point of difference with peers. It is totally normal to have different opinions during the code discussions and to sort any such conflict there should be a constitutional typed scripture that can help to sort out such conflicts. Zen of python is that type of constitutional scripture for me, that helped me whenever I need it.

After switching to Java it still guiding for different confusions and problems. And gladly the Zen of Python teachings are still helping me in such regards. All the teachings of Zen of Python could easily be applied to Java. Now for this reason, the Zen of Python has started to be called the Zen of Programming by me.

The Zen of Python is to me a cause-and-effect principle that teaches you good coding practices.

Zen of python is that type of constitutional scripture for me, that helped me whenever I need it.

Final thoughts

It’s been just a while I have started working on Java. So far perception is honestly great and I can say that in just these few days, everything is very different. But things are getting better day by day. Worth adding that mentors play an vital role in your new language acquisition. So huge respect for my all mentors at Bazaar. Some good things I can share for now is that though I have to write more line of code in Java as compare to Python. Code compiling where it is slow, at the same time it is very fast. Code compiling saving me from many testing efforts that I need to do in Python. There are still some other challenges which will be solved by time. But one thing is sure that Python’s teaching in me won’t be lost. My love for python won’t last ever.

Java is my new Python ❤️

Disclaimer:

Bazaar Technologies believes in sharing knowledge and freedom of expression, and it encourages it’s colleagues and friends to share knowledge, experiences and opinions in written form on it’s medium publication, in a hope that some people across the globe might find the content helpful. However the content shared in this post and other posts on this medium publication mostly describe and highlight the opinions of the author, which might or might not be the actual and official perspective of Bazaar Technologies.

--

--

Hammad Qureshi
Bazaar Engineering

Hands-on software engineer with a track record of incorporating user and business requirements for logistics, fintech, retail and ecommerce paradigms.