Fork me on GitHub
#architecture
<
2019-06-11
>
mathpunk19:06:37

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

mathpunk19:06:44

it has zero Clojure in it right now

mathpunk19:06:25

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ý (HolyJak)12:06:14

That is what I do. Check out #gradle

mathpunk19:06:55

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

Alex Miller (Clojure team)20:06:24

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

seancorfield20:06:18

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

seancorfield20:06:56

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

Alex Miller (Clojure team)20:06:27

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

Alex Miller (Clojure team)20:06:59

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

seancorfield20:06:51

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

seancorfield20:06:20

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

Alex Miller (Clojure team)20:06:37

mine also does not require compilation

Alex Miller (Clojure team)20:06:32

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

seancorfield20:06:53

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

Alex Miller (Clojure team)20:06:16

no aot or genclass there

hiredman20:06:03

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

Alex Miller (Clojure team)20:06:17

those are very different problems

Alex Miller (Clojure team)20:06:21

I'm targeting the latter

Alex Miller (Clojure team)20:06:24

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

hiredman20:06:31

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