architecture

mathpunk 2019-06-11T19:57:37.000900Z

I work on a Java/JavaScript app, and I had the thought that I could start developing a kind of SDK to help myself and other devs with testing

mathpunk 2019-06-11T19:57:44.001100Z

it has zero Clojure in it right now

mathpunk 2019-06-11T19:58:25.001800Z

I'm guessing, if I want to start putting some in, I start with our gradle configuration? I've worked in Clojure far, far more than I've worked in Java

Jakub Holý 2019-06-13T12:30:14.016600Z

That is what I do. Check out #gradle

mathpunk 2019-06-11T19:58:55.002400Z

I think of Clojure app development as starting with lein new... so this is new territory

alexmiller 2019-06-11T20:07:24.003Z

I actually wrote up an example repo that you might find useful this week for calling from Java into Clojure https://github.com/puredanger/clojure-from-java

mathpunk 2019-06-11T20:14:25.003300Z

oh cool

seancorfield 2019-06-11T20:23:18.004400Z

Stu also posted a clojure-from-java repo this week https://github.com/stuarthalloway/clojure-from-java

seancorfield 2019-06-11T20:23:56.005100Z

It takes a very different approach -- one that I've taken myself in the past.

alexmiller 2019-06-11T20:28:27.005700Z

yeah, I think mine is much less messy when you scale up

alexmiller 2019-06-11T20:28:59.006400Z

as you just write a small fixed amount of shim, and then the rest is in clojure

seancorfield 2019-06-11T20:44:51.007700Z

I think the key, in either approach, is to try to keep the interop API small, but I like that Stu's involves no compilation: just package .clj files in with the Java using Maven (or "your current Java build tool").

seancorfield 2019-06-11T20:46:20.008900Z

It all gets more interesting when you start your Java app with the -D to get a Socket REPL going 🙂

alexmiller 2019-06-11T20:52:37.009100Z

mine also does not require compilation

alexmiller 2019-06-11T20:53:32.009900Z

they overlap, I just make the bolder step of suggesting you should actually write your Java API in Java

seancorfield 2019-06-11T20:53:53.010400Z

Oh, looking at the repo it seemed to build an uberjar and compile files... are those just the Java files?

alexmiller 2019-06-11T20:53:59.010600Z

yes

alexmiller 2019-06-11T20:54:16.010900Z

no aot or genclass there

2019-06-11T20:55:03.012200Z

it is sort of like, if I am a java dev and want to use a random clojure library, how would I do it vs. if I am clojure dev and want to provide a nice interface for java programmers how would I do it

alexmiller 2019-06-11T20:55:17.012400Z

those are very different problems

alexmiller 2019-06-11T20:55:21.012600Z

I'm targeting the latter

alexmiller 2019-06-11T20:57:24.014600Z

for the former, that's not a use case Clojure is trying to target

2019-06-11T20:57:31.014800Z

there is some overlap in the solutions because they are both interoping in the same direction, but a different stance and priorities results in a different solution