Discover your dream Career
For Recruiters

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.)

 

author-card-avatar
AUTHOROscar Varone Insider Comment
  • Al
    Alexis Rodriguez
    17 July 2019

    I wonder if this hack will help with debugging Python:
    import sys
    for fname, obj in sys.modules[__name__].__dict__.items():
    ..if '__call__' not in obj: continue
    ..def debugWrapperf(*args, **kwargs, obj=obj, d={'ncalled':0}, module=sys.modules[__name__]):
    ....ret = obj(*args, **kwargs) # call function
    ....d['ncalled'] += 1
    ....if d['ncalled'] == 2: module[obj.func_name] = obj #restore original function
    ....print("%s.%s(%s, %s) -> %s"%(mname, fname, ','.join(args), str(kwargs), ret))
    ....return ret
    ..debugWrapperf.func_name = obj.func_name
    ..sys.modules[__name__].__dict__[fname] = debugWrapperf
    Changes every method in the current module so that its replaced with a wrapper function that will print out its arguments and return value when its called then remove itself. You could also do this for every module...

  • gb
    gbk
    1 May 2019

    Is there any scope for Salesforce in Financial Services especially with Salesforce Vlocity making its mark in Financial Services

  • An
    Andy Chow
    28 March 2019

    In finance, learn SAS or another language actually used in the field. Like PL/SQL, COBOL, etc. I've never seen Java or Python used at all. All the mainframe stuff is COBOL, and COBOL programmers are so rare you're guaranteed a nice salary. If you're an analyst, you're more likely to use SAS, R, or Fortran. Maybe APL in the insurance industry.

  • Ba
    Banker
    27 March 2019

    Lol. Did the author never heard of using annotations in Python to indicate what types are expected as input and outputs? And what about packages that will automatically enforce this? Basically makes this article obsolete.

Sign up to our Newsletter!

Get advice to help you manage and drive your career.

Boost your career

Find thousands of job opportunities by signing up to eFinancialCareers today.
Recommended Jobs
Durlston Partners
Systematic Trading Developer
Durlston Partners
New York, United States
Front Office Java Developer
New York, United States
Garrison Associates, LLC
Lead Object-Oriented Developer
Garrison Associates, LLC
New York, United States
Barclays
Senior Java Developer VP
Barclays
Florham Park, United States

Sign up to our Newsletter!

Get advice to help you manage and drive your career.