Fork me on GitHub

Mornin' Happy Hump Day!


Good Morning!


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

👍 9

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

Jakob Durstberger10:08:51

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


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


and uses spec for testing


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.


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

Ben Hammond16:08:07

what are you trying to do with Spring?

Ben Hammond16:08:57

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

Ben Hammond16:08:10

but that was back on version 2.5.6 Maybe Its Changed


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

Ben Hammond16:08:57

going off piste with Hibernate - now that is hardcore

Ben Hammond16:08:06

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


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


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.


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


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


which covers the majority of cases I suppose.


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


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


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


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


with all the ceremony that comes with that.


was a lot easier using next.jdbc 🙂

Ben Hammond16:08:04

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

Ben Hammond16:08:40

And suddenly you are contemplating a very steep learning curve

Ben Hammond16:08:23

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

Ben Hammond16:08:58

Clojure has a pretty steep learning curve too of course


Yeah,I'm off the deep end 🙂


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.


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

👍 3

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

😂 3

In the early days, (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 🙂


glad that's changed 🙂


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


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


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.


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


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

👍 3