clojure-uk

A place for people in the UK, near the UK, visiting the UK, planning to visit the UK or just vaguely interested to randomly chat about things (often vi and emacs, occasionally clojure). More general the #ldnclj
jiriknesl 2020-08-26T04:35:54.046900Z

Morning

seancorfield 2020-08-26T04:55:17.047200Z

Mornin' Happy Hump Day!

dharrigan 2020-08-26T05:42:28.047500Z

Good Morning!

Jakob Durstberger 2020-08-26T07:25:11.047700Z

Morning 🙂

alexlynham 2020-08-26T07:28:31.047800Z

morning

dominicm 2020-08-26T07:45:46.048Z

Morning

thomas 2020-08-26T08:44:57.048200Z

moin

thomas 2020-08-26T09:03:18.049100Z

I have just merged the 3rd PR for my MQTT broker. Someone is actually looking at my code.

👍 3
thomas 2020-08-26T09:03:32.049500Z

And improving is, but that isn't that hard 🙂

Jakob Durstberger 2020-08-26T10:05:51.049800Z

Very nice, do you have a link to the repo?

thomas 2020-08-26T11:07:17.050200Z

https://github.com/thomas-shares/mqtt-kat

thomas 2020-08-26T11:08:26.050500Z

it is a MQTT server (and client to some degree)

thomas 2020-08-26T11:08:33.050700Z

and uses spec for testing

dharrigan 2020-08-26T15:56:40.052100Z

sigh I know not many people here have use of Spring, but I use it quite a bit at work (with my Kotlin adventures). It's okay...until you have to step out of it's walled garden, then it's back to writing reams of code and figuring out the load order of the beans and whether any are being ignored/replaced by your stuff.

dharrigan 2020-08-26T15:57:36.052900Z

What is super simple in Clojure, having a few jdbc connections to a few databases, is non-trivial to do with Spring

2020-08-26T16:13:07.053700Z

what are you trying to do with Spring?

2020-08-26T16:13:57.054600Z

I mostly liked it in a > It doesn't often make me do things I don't want to do kind of way

2020-08-26T16:15:10.054900Z

but that was back on version 2.5.6 Maybe Its Changed

mccraigmccraig 2020-08-26T16:15:32.055500Z

what does it do that makes having a few jdbc connections hard @dharrigan?

2020-08-26T16:15:57.056200Z

going off piste with Hibernate - now that is hardcore

2020-08-26T16:17:06.057400Z

and you don't have to use Spring? Just do it in plain old java

mccraigmccraig 2020-08-26T16:17:57.057900Z

i seem to recall using it back in the day, getting rid of the xml frontend and replacing it with a jruby frontend, and it was quite nice then... but we were moving a mostly java system over to ruby/jruby, so that kinda sorta made sense for us

dharrigan 2020-08-26T16:49:33.058800Z

Well, I'm using JOOQ which is a nice DSL for SQL, you run it against your schema and it generates type-safe classes etc.. Then you can use a fluent DSL to construct your SQL queries. It's supports in Spring Boot for a while now.

dharrigan 2020-08-26T16:49:52.059400Z

It gives me control of precisely crafting the SQL to send to the DB.

dharrigan 2020-08-26T16:50:07.059800Z

But, Spring Boot, is very opinionated. It assumes just one JDBC connection.

dharrigan 2020-08-26T16:50:26.060300Z

which covers the majority of cases I suppose.

dharrigan 2020-08-26T16:50:59.061100Z

So, if you want to have another DB connection to another database, to then merge in data from two different databases, you have to construct your own DSLContext

dharrigan 2020-08-26T16:51:23.061700Z

but, there's this magic "@ConditionalOnMissingBean" on the JooqAutoConfigure on Spring Boot

dharrigan 2020-08-26T16:51:49.062100Z

if you try to define your own dsl context, it won't create the default one.

dharrigan 2020-08-26T16:51:59.062400Z

so you have to create both or N-many dsl contexts yourself

dharrigan 2020-08-26T16:52:14.062700Z

with all the ceremony that comes with that.

dharrigan 2020-08-26T16:52:58.063200Z

was a lot easier using next.jdbc 🙂

2020-08-26T16:57:04.065400Z

So you step off the happy path and suddenly you have to grok how the component parts are bolted together

2020-08-26T16:57:40.066500Z

And suddenly you are contemplating a very steep learning curve

2020-08-26T16:58:23.067300Z

Yeah from that point of view I'd agree with you

2020-08-26T16:58:58.068100Z

Clojure has a pretty steep learning curve too of course

dharrigan 2020-08-26T17:01:42.068400Z

Yeah,I'm off the deep end 🙂

dharrigan 2020-08-26T17:03:59.071Z

The thing, however, with Clojure, is that it has only a few constructs, and the libraries are generally well thought out (i.e., next.jdbc). I can see in front of me how things work and the layer(s) are thin. With Spring, it works really well and it's fantastic for quickly getting something out (for the business that is!) but with lots of magic stuff happening behind the scenes (lots of proxying and annotations), it's all hidden from you, so if you do need to do something a bit different, then you have to delve very deep to see what is going on, then surface again for some air to pretty much DIY.

dharrigan 2020-08-26T17:04:45.071500Z

It feels more natural, more what-it-means-to-be-a-programmer, using Clojure with some libraries, than Spring 🙂

👍 1
dharrigan 2020-08-26T17:05:26.072200Z

If I can channel Dr McCoy for a moment..."I'm a programmer, not a Spring developer dammit" 🙂

😂 1
seancorfield 2020-08-26T17:10:16.073200Z

In the early days, clojure.java.jdbc (nee clojure.contrib.sql) used a single dynamic Var for the DB connection so it was almost impossible to use with multiple connections/multiple databases too 🙂

dharrigan 2020-08-26T17:26:54.073400Z

glad that's changed 🙂

seancorfield 2020-08-26T17:34:29.073900Z

It was a very nasty set of breaking changes. I would handle it very differently today.

seancorfield 2020-08-26T17:35:08.074400Z

(I think I made breaking API changes in three releases as I worked on c.j.j)

dharrigan 2020-08-26T19:18:59.076700Z

You know one of the other attractions that I have with Clojure, is it's data oriented approach - just maps, vectors and lists (and a few scalars). It makes shuffling data in and out of a database via an API (which goes on the wire as JSON) so refreshingly easy and simple to do.

mccraigmccraig 2020-08-26T21:09:44.078700Z

yeah, data orientation is definitely one of clojure's superpowers

mccraigmccraig 2020-08-26T21:10:43.079900Z

every time i have to do some data manipulation in java or js i cry a little

👍 1