Why is NetLogo implemented in a mix of Java and Scala?

Why is NetLogo implemented in a mix of Java and Scala? Was it due to better concurrency support? I am not familiar with Scala, but I think that a functional programming style is better suited to expressing concurrency guarantees.

+5
source share
1 answer

The following is based on my experience as a lead NetLogo developer from 2001 to 2014.

All Java code in NetLogo is old code that we simply could not convert to Scala.

The NetLogo project began around 1999, long before Scala.

By the time we switched to Scala in 2008, we had accumulated a lot of Java code. Over time, this Java code has been converted to Scala, but not all. Converting absolutely all of it to Scala would be a great effort; it's not worth it.

Quite a lot of all new code in NetLogo, since 2008, is in Scala.

Concurrency was not the primary motivation for switching from Java to Scala. (Most NetLogo has only two streams: a GUI stream and a task stream. Only BehaviorSpace uses more threads, and it is relatively easy to save them separately in any language.)

The main motivation for using Scala was that Scala is a much more powerful, expressive, flexible and elegant language than Java, with much better support for functional programming and immutability, which helps to write elegant, correct code in writing.

This makes Scala more fun and satisfying to work with, and the resulting code is believable and shorter and more convenient to maintain. Using Scala also (most often, in our experience) attracts smart people to the development team.

+6
source

Source: https://habr.com/ru/post/1270036/


All Articles