Fork me on GitHub
#clojure-uk
<
2020-04-30
>
dharrigan05:04:19

Good Morning!

guy05:04:34

morning 😭

guy06:04:05

kids were up at 5:30 today so I'm sleepy/grumpy

guy06:04:49

I just knocked over my coffee onto the floor too sigh.

dharrigan06:04:28

Knightmare!

😄 4
Jakob Durstberger07:04:48

Happy Pre-Friday everyone 🙂

🎉 8
thomas07:04:50

Virtual Friday for me.... 🙂

dharrigan08:04:22

So, question. I'm generating several "reports" (let's say maps for now) that are the results of hitting a database with queries. The queries are standalone and thus can be done in parallel.

dharrigan08:04:30

Does this look okay? (keeping it simple...)

dharrigan08:04:32

(let [report1 (future (report-service/report1))
      report2 (future (report-service/report2))
      report3 (future (report-service/report3))]
  {:report1 (deref report1 5000 nil)
   :report2 (deref report2 5000 nil)
   :report3 (deref report3 5000 nil)})

reborg08:04:02

Looks good to me! Same approach taken here https://github.com/reborg/parallel#plet (my small lib)

dharrigan08:04:49

I was reading another function from your book yesterday Renzo

dharrigan08:04:59

map (and filter and reduce)

reborg09:04:27

that is making me think for the need to surface a timeout option

dharrigan09:04:32

timeouts are good 🙂

dharrigan09:04:46

and a default if timeout reached 🙂

dharrigan13:04:58

As someone who uses Spring (for my Kotlin work). I'm super happy that finally they've come to their senses and dropped the horrible naming stragegy they were using:

Conor14:04:43

My condolences

dharrigan14:04:52

Ah, tis okay 🙂

dharrigan14:04:01

It's all good 🙂

dharrigan14:04:39

Spring Boot is very productive - although, one tends to end up as a "Spring" developer rather than a Java/Kotlin developer

dharrigan14:04:52

too much magic, but very productive, business-get-shit-done magic 😉

Ben Hammond14:04:08

heh. that song still puts a smile on my face

folcon14:04:14

@dharrigan As someone who’s never used spring, what does it give you and what’s the tradeoff?

dharrigan14:04:49

It gives quite a lot (talking mostly about spring boot here), full object lifecycle management, mostly it's all about IoC and dependency injection

dharrigan14:04:50

spring boot comes with a lot of "starters" out of the box - for example, do you want to use kafka - just add spring-cloud-starter-stream-kafka to your deps

dharrigan14:04:09

and it pulls it all in, configures appropriate listeners and does all the marshalling for you

dharrigan14:04:26

or, perhaps you need RESTful APIs - spring-boot-starter-web

dharrigan14:04:46

create an object, annotate the method with @GetMapping and away you go

dharrigan14:04:54

again, takes care of the marshalling for you

dharrigan14:04:31

so, it basically gives an opinionated way of doing things, hides all the complexity but exposes SPIs and hooks if you need to modify

dharrigan14:04:44

but for 80% of the cases, it works for nearly all problem domains out-of-the-box.

dharrigan14:04:54

leaves you to concentrate on writing the business logic.

folcon14:04:45

Hmm, interesting, I see the appeal =)…

dharrigan14:04:34

It's very popular

Conor14:04:42

From my point of view it contains too much magic and is dog-slow

Conor14:04:59

But it's very enterprise so I have to understand it

rhinocratic14:04:53

I used to use it a lot when it was all XML configuration, and I was a fan (after all, Java needed something for dependency injection). I returned to it after a break of a couple of years, and now there's way too much "action at a distance" and aspect-oriented "magic". It now seems to hide the application structure rather than documenting it.

folcon14:04:39

I personally don’t see the issue with magic as long as you can dig a little and find out what it’s doing, if you can’t then it’s less, here are a bunch of sane defaults for various use cases and more I’m just going to try and always guess what you want. The latter can be really bad :(…

mccraigmccraig14:04:44

aspect-oriented as in modifying the classfiles to add in before/after/around method interceptors according to some annotations or recipe ?

rhinocratic14:04:36

Yes - at least I assume that's how it's being done, since annotations abound. I no longer feel that I know what I'm doing with it! Spring was increasingly heading in that direction in the later XML days.

mccraigmccraig14:04:32

i played with some AOP stuff which did that back in the bad old days... i found i didn't like it much, in a similar way to how i don't much like ruby metaprogramming - it makes it harder to get an understanding of how control and data is flowing in a program

rhinocratic15:04:39

I quite agree. Not a rubyist myself, but I had similar qualms about Groovy. It's by no means a bad language, but it allows one to do terrible things whose causes will be hard to discover.

folcon15:04:00

Wasn’t that approach supposed to be for pulling out cross cutting concerns such as logging etc from core business logic?

rhinocratic15:04:09

I believe that was the idea, originally.

dharrigan14:04:18

With Sprint Boot - I've never had to write any xml, nor worry about AOP

dharrigan14:04:45

They've removed XML as far as I know, it's all java config now

dharrigan14:04:59

(or rather kotlin config, as that's what I use at work too )

Ben Hammond14:04:20

Spring was sooo much better the crappy J2EE stuff that it replaced but that was a long time ago now it seems that it's gone some way to turning into that crappy J2EE stuff

Ben Hammond14:04:01

for me it boiled down to the question > does it make me do things that I don't want to do? like force me to subclass their concrete class, or conform to their opinion about how to structure the classes and Spring (mostly) didn't boss me around

rhinocratic14:04:47

True - it often provided helper classes that you could extend_,_ but there was usually a non-invasive alternative.

thomas15:04:42

I had problems with all the magic stuff going on in Spring boot.... never quite grogged it.

jasonbell15:04:32

Spring Boot, oh blimey please no, not that.

😁 8