Java vs. Python in finance, which one should you learn first?

eFC logo
Java vs. Python in finance, which one should you learn first?

If you’re thinking about learning a programming language to safeguard your financial services career, or to transition into a technology job, then the language du jour is Python. A fine choice in of itself, and very handy if you want to work at FinTechs. I work in it myself every day. However, getting a technology job can be a numbers game thanks to tortuous interview practices, and at banks and many asset managers Java still reigns supreme in the open job count. 

When I first started coding in Java at Investment Banks over a decade ago, I routinely came across horror shows of spaghetti code. Things have moved on significantly, and overall the quality of code I see day to day is now pretty good. Opinionated Java frameworks like Spring mean that you can get a lot done with very little code. The latest incarnations of Java contain many of the functional aspects available in Python, and whilst it lacks popular finance packages like Pandas and NumPy, it makes up for it in a rich landscape of native data structures and third-party libraries.

Others may disagree but I think it would be far easier to learn Python coming from a Java background than the other way around. I did this myself, and it took me a week or two to become very productive in Python. Studying Java, you will learn important concepts around object orientation such as encapsulation, abstraction, polymorphism and inheritance. Frameworks like Google Guice and Spring will introduce you to dependency injection and how to structure programs, so they are easy to test and maintain. Python is object oriented, but it’s such an open language that if you start with it first, you may lack awareness of how to structure large programs properly.

Python has other problems too. At a scale where you're sharing and working on code with many other people, Python can present problems due to duck typing and a lack of verbosity. Duck typing is where you don’t specify what the type (like integer, character or Boolean) of a variable is - it is inferred. And a language being not very verbose means a lot can be accomplished with not much code. All of this is great in isolation, but it can make what is going on very opaque to others.

There are some concrete examples of Python's problems in finance. For example, JPMorgan's Athena platform has millions of lines of Python code and novice users can find it difficult to discern what kind of data is being manipulated. The obvious solution is to look at unit tests but often there aren’t any because the file was created before the mandatory unit test rule was enforced...

In systems as large as those used by banks, it can be difficult to figure out what the intention of basic code is simply by looking at Python. When everything is coded in Python banks are forced to rely on developers being good citizens. In a large organisation that’s not ideal because they’ll naturally have their fair share of checked-out coders who don’t adhere to standards.

In Java, on the other hand, navigating a large codebase can be easier as you always know what datatypes are being referred to.  Even if there are no unit tests, you still have a rough idea of what is going on at a glance.

Java is also truly multi-platform. You’ll be able to package and run your code on many different kinds of machine, and it’s the official language of Android. You may have heard that Java runs much faster than Python, which is true most of the time. Because of this, high frequency trading, order management and trading execution are almost certainly going to be implemented in a language like C++, C# or Java, rather than Python. And whilst Python does have threads, you’ll make much more use of them in Java, and you’ll learn a lot more about how to code in a multi-threaded way.

Having both languages under your belt is really where you want to be – but take it from me, start with a language like Java first if you’re serious about becoming a top-class technologist.

Oscar Varone is the pseudonym of a former VP-level technologist in an investment bank, who now works in a fintech.

Have a confidential story, tip, or comment you’d like to share? Contact: sbutcher@efinancialcareers.com in the first instance. Whatsapp/Signal/Telegram also available. Bear with us if you leave a comment at the bottom of this article: all our comments are moderated by human beings. Sometimes these humans might be asleep, or away from their desks, so it may take a while for your comment to appear. Eventually it will – unless it’s offensive or libelous (in which case it won’t.)

 

Related articles

Popular job sectors

Loading...

Search jobs

Search articles

Close