I have an interesting architectural question regarding an application that I am developing using both Clojure and Java. The application involves a lot of intensive, concurrent data processing tasks that need to be orchestrated.
Here's the rationale for mixing both Clojure and Java:
- Java is needed for some pretty CPU-intensive numerical code, where I need to optimise the algorithms to run as fast as possible on the JVM. Clojure can't quite achieve this yet, and such code would not be very idiomatic in Clojure because the algorithms require a lot of mutable data for performance reasons.
- Clojure is (IMHO) far better for orchestrating the overall flow of the application, with its excellent support for functional programming, interactive dynamic development at the REPL and concurrency features.
Given that I'm using both languages - what logic or principles should I apply to determine the dividing line between the two? In particular, I'm interested in how to design an API/interface that would be at the right kind of level to take advantage of the relative strengths of both languages.