Discover your dream Career
For Recruiters

Real programmers write Java like FORTRAN

I’m a Java coder and I work on high speed trading systems. I know that people dispute whether Java is the best language for really low latency work, but my experience is that it is absolutely viable. I have seen optimized Java code that is only about 20-30% slower than very, very optimized C code and this is pretty awesome. The application was able to respond to market signals within single digit microseconds every time.

Real programmers can write FORTRAN in any language. The issue with Java isn't that you can't write low latency code. It’s that you are left almost completely without tools. There’s very little you can use from Java standard libraries. You’re therefore left scratching your head about how to solve even the simplest problem like managing memory without something coming and suddenly creating a lot of latency where you don't want it to happen.

If you can code a FORTRAN-like Java, you can overcome this. And Java has multiple advantages, as follows:

  1. Java is a simpler language than C++, but it allows for easy object modelling, which is not available in plain C. The smaller feature set of the language also helps the developers stay focused on the logic of the application rather than on expressing their technical superiority through application of all the bells and whistles available in the standard (which often makes C++ code hard to read and improve by others).  

  1. Java is easier to debug than C++. It generates very clear crash reports in form of comprehensive stack traces that allow the developer to find out what went wrong very quickly.  

  1. Depending on how latency-sensitive an application is, the Java developer can choose a different memory management technique. The zero-garbage approach is not always required. For example, you can always use a modern garbage collector, which helps speed up the development. While pauses are not desirable, if they don’t happen too frequently and are short, they can be tolerated, as long, as the solution is able operate at low latency most of the time. These requirements will obviously vary depending on market, client or trading strategy.   

  1. Java is an established language. It’s also the first programming language for a huge population of developers with various levels of experience. It can be hard to unlearn what you know already, but often the same developers, when trained, can code low-latency modules as well as typical enterprise/web applications.   

  1. Java has a rich development ecosystem and can be used by developers directly on Windows, Mac and various distributions of Linux. The JVM takes care of most of the differences. The same program (jar) will run on every platform (although some small additional platform-specific libraries may be required for best results on the low-latency front).  

  1. Java has the “assert” keyword, which allows coding of "self-testing" logic within an application. This logic can be selectively disabled/enabled depending on the level of acceptable overhead and the testing strategy. In production the “self-testing” logic is ignored, without the need to recompile anything. It’s very useful for checking state consistency when pooling/reusing objects during unit and integration testing as well as in live QA/UAT environments.

I’m sure there are people who don’t agree with some of the points above, but I’ve seen low latency Java working in practice. There are firms that have been using Java in electronic trading for more than 15 years and that are actively investing in R&D in order to improve their execution speed and quality. Equally, firms that strictly focused low latency/HFT will always be looking for ways to beat others in their niche. Some use C/C++ and FPGAs and other specialized techniques to reduce their delay by a single nano-second. I’ve seen Java, C++ and FPGA used in parallel.

Frank Becker is a pseudonym

Photo by Michael Dziedzic on Unsplash

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
AUTHORFrank Becker Insider Comment
  • Ha
    Hassan Boukhamseen
    6 January 2021

    Real programmers don't write java

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.
Latest Jobs
Northern Trust
Senior Portfolio Advisor
Northern Trust
Washington, United States
Northern Trust
Analyst, Loan Operations
Northern Trust
Chicago, United States
Northern Trust
Senior Analyst, Loan Operations
Northern Trust
Chicago, United States
Standard Chartered Bank
Executive Director, Sustainable Finance
Standard Chartered Bank
New York, United States
Standard Chartered Bank
Intelligence Officer
Standard Chartered Bank
Newark, United States
Northern Trust
Banking Relationship Advisor
Northern Trust
Dallas, United States

Sign up to our Newsletter!

Get advice to help you manage and drive your career.