clojure-europe

For people in Europe... or elsewhere... UGT https://indieweb.org/Universal_Greeting_Time
dharrigan 2020-12-21T06:06:17.068100Z

Good Morning!

simongray 2020-12-21T06:37:44.076800Z

good morning

slipset 2020-12-21T06:40:28.081100Z

@orestis a bit late to the party, but to my defense, it was Sunday yesterday, and I was out windsurfing. A couple of things you said resonates with me. One was that you are writing fns that return queries. Our code Åse was littered with find-by-id, find-by-email, find-all etc (using mongo). These are in fact just two fns, query, and query-one (I’m sure you could argue that they’re just one fn as well) which executes a bunch of queries. But there is a subtle difference. I can compose by-id, and by-email, using merge, something I could not do with find-by-id and find-by-email. The second thing: My battle is not so much with “let’s use every cool tech available”, but more “the only way I know to program is OO, let’s do that in Clojure”. Luckily, I’ve been able to slowly make the code more functional over time and at the same time learnt a lot that’s still proving hard to articulate, but that I’m starting to be able to communicate.

2🙀1😎
orestis 2020-12-21T06:41:24.081500Z

(Reaction for windsurfing)

1😂
slipset 2020-12-21T06:45:04.087100Z

In fear of invoking the wrath of @raymcdermott, in one of the team-of-teams episodes on the Idealcast, it was mentioned that you need to keep SEALs busy/occupied otherwise you were in for a lot of trouble, in the sense that SEALs are a rowdy bunch. I think this holds somewhat true for devs as well, all though there might be other dynamics in play as well. Left to our own devices, we tend to start playing with tech rather than business problems.

slipset 2020-12-21T06:46:47.089600Z

As an example from my early days as a Perl programmer churning out cgi-scripts. The tasks were so boring that I used to figure out novel ways to solve the tasks. The code was not always readable.

slipset 2020-12-21T06:54:37.094500Z

I remember that my scripts tended to end in something like:

$dispatch{$query{"action"}}->(%query)
Basically, %dispatch was a map from a string to a fn which would then be executed on the query. Normal stuff now, but not so normal in ’96, where you’d normally spell this out in an enormous if/then/else And, when I started programming Java in around 99, I was quite astonished by the amount of code you had to write to achieve nothing. The first iteration of servlets? Concatenating html-strings in Java? That must have been the marketing success of that century.

orestis 2020-12-21T06:57:17.097700Z

I came up with the idea of a “query description” which is a query-or-pipeline, the collection, fields projection, sorting etc, which can then be executed to fetch, delete, count etc etc. Most of the query-like graphql resolvers we have are concerned with composing this, using domain-functions like “members-of-channel” etc etc. Should be quite similar to your version.

synthomat 2020-12-21T06:57:55.097900Z

good morning!

orestis 2020-12-21T07:00:27.101500Z

I switched from Java to Python doing my graduate thesis with a Markov model, when the Java libraries for Markov models wanted the states to be an enum. My states were alphabet digrams and I was too lazy to go type in aa, ab, ac ... xz, zz !!

orestis 2020-12-21T07:00:45.102100Z

Thankfully I didn’t think of code generation!

slipset 2020-12-21T07:01:02.102500Z

Yes, sounds like the same thing. We would have find-by-email , count-by-email delete-by-email as three different fns, where they in reality are three general fns made specific by the queries passed to them.

orestis 2020-12-21T07:06:09.107300Z

Our node code base was super confusing. Things like this.model.find(...) where model is a raw collection. No attempt at introducing an abstraction on top of that.

orestis 2020-12-21T07:07:49.109900Z

But then people realized that they needed some way of enforcing permissions so the kinda monkey-patched model to be our own thing and that silently mutates (in place) your query and now good luck figuring out what’s going on... you’d have to go in and add print statements at the bowels of the system and sift through the output.

slipset 2020-12-21T07:12:20.110700Z

From the early days of CMP (from EJB), there was so much boiler plate to be implemented. You needed local and remote interfaces for each entity, IIRC for every thing you wanted to persist to the database, you needed four files, two xml and two java. This was of course tedious to write, so a host of “give me your database tables, and I’ll generate this for you” tools cropped up. And those tools almost worked, but are a good example of devs solving the wrong problem. I think what I’m trying to remember is middlegen https://www.theserverside.com/discussions/thread/29232.html

orestis 2020-12-21T07:18:31.114400Z

Heh, my first real job was working on a JSP thing with EJB (I think), where we had to write SQL by hand. I was young and read JoelOnSoftware, so obviously the old hands were doing it wrong. I embarked on a campaign to use Hibernate, but in the process realized that it was actually much more verbose and couldn’t handle some of our sophisticated queries anyway. I’m glad I found that out early enough :)

slipset 2020-12-21T07:22:21.117100Z

I used Hibernate for years and was quite happy with it. Yes it was magic, yes it had it’s problems, but for in-house crud-apps, it worked ok. Not sure how much time we saved in the end, but I think Hibernate solved one problem for the Java community. It became the de facto standard for ORMs which meant that not every tech-lead out there implemented their own.

slipset 2020-12-21T07:23:11.118100Z

I did make an ORM at the company I worked for at the time, luckily it was rather sucky compared to Hibernate, so we ditched it.

2😂
raymcdermott 2020-12-21T07:33:56.119800Z

No wrath @slipset just disappointment :)

raymcdermott 2020-12-21T07:36:30.123300Z

I remember, back in the ahem day, making function tables to call different entry points in C programs. This was really exciting for me but it took me 20 years to learn that it’s actually a paradigm

raymcdermott 2020-12-21T07:42:32.127300Z

Then later, when I worked for Ingres their C code was also littered with function pointers. I felt validated but their original engineers probably knew something of FP given that Stonebraker was a CS professor

raymcdermott 2020-12-21T07:46:38.130600Z

I was introduced to that style in my treasured monthly copy of the C Programming Journal. Or was it Dr Dobbs? Ah nostalgia: when you’ve got nothing better to say

raymcdermott 2020-12-21T07:49:15.131700Z

Man point is that it was considered something of a trick

orestis 2020-12-21T07:53:13.132600Z

In python it was also a thing; not commonly used but it was pointed out as a case-statement replacement many times.

slipset 2020-12-21T08:05:29.133600Z

@raymcdermott Your disappointment is so much harder to bear than your wrath. If only you were angry with me.

2😂
thomas 2020-12-21T08:14:44.133800Z

morning

slipset 2020-12-21T08:15:44.135Z

I’m missing @plexus advent of blog challenge from last year. I got a couple brewing, but can’t seem to get them out: 1. Clojure: simple and easy 2. Naming a la carte

orestis 2020-12-21T08:40:16.135700Z

Ha, @slipset I always want to write more about Clojure but writing is hard. I’m happy to give feedback if you want to share a draft.

slipset 2020-12-21T08:41:33.136400Z

I appreciate the offer, but I tend to treat my blog posts as longer tweets, so they’re more a place to record a thought than anything else.

2020-12-21T09:09:35.136900Z

Morning

dominicm 2020-12-21T09:42:22.137100Z

@slipset one benefit to having those functions is that you can be sure there's an index backing them.

borkdude 2020-12-21T09:43:03.137300Z

Good morning

orestis 2020-12-21T10:37:02.137800Z

@slipset I’m using this channel as this “record a thought” place 😄

1❤️
slipset 2020-12-21T10:43:50.139800Z

@dominicm there is something I’m missing. Ah, right, you mean that the composition of queries can lead to queries which don’t have indexes, yes, that’s true, but I think those are two separate concerns.

dominicm 2020-12-21T10:46:43.139900Z

I wish :). Depends on your db though.

mdallastella 2020-12-21T10:49:46.140100Z

Morning

slipset 2020-12-21T10:51:59.141600Z

@dominicm what db are you using? mongo and postgres lets you create indexes as you want (it’s still up to you to know that you want to have those indexes (and add them), but I think that is a good thing)

dominicm 2020-12-21T10:53:47.141700Z

@slipset postgres. But it's more just a case of having to create those indexes.

slipset 2020-12-21T10:56:22.143400Z

But, you wouldn’t want a find-by-id-and-email like this:?

(defn find-by-email-and-id [db id email]
  (ensure-index! db ...)
  (query! db ... {:id id :email email}))

1😱
dominicm 2020-12-21T12:37:15.143800Z

I'm more of a problems than a solutions kinda person.

1😂
jasonbell 2020-12-21T13:24:16.144Z

Morning.

slipset 2020-12-21T13:45:41.144600Z

I find that problem kind’a people are unfairly viewed as problematic or negative.

1👍
slipset 2020-12-21T13:46:00.144900Z

“Don’t give me problems, I want solutions”

slipset 2020-12-21T13:46:57.145900Z

Whereas I can regard a problem almost like a gift. Here’s a thing I found that’s not working quite right, and I find it interesting, do you want to have a look at it too?

jasonbell 2020-12-21T13:50:23.148Z

@slipset - All in the balance of risk. One of things I loved about working with @otfrom was the permission to try even if I didn’t know the full solution. “Do you know XYZ”, “No, but I can figure it out, give me n days to tinker”. Solutions usually present themselves after investigation. The management version of “there are no problems, only solutions” is nonsense in my eyes.

1💯
jasonbell 2020-12-22T09:27:15.165500Z

Damn, found out…….

orestis 2020-12-21T14:07:21.149200Z

> Solutions usually present themselves after investigation. Hear hear! I try to stress to my team and my bosses that we need to be doing investigations (tinker, spike, flailing around) otherwise we won’t get anything new done, only rehashes of old. It seems to work quite well so far 🙂

2020-12-21T14:36:33.149400Z

this is clearly propaganda. Jade is either a bot or an op

2020-12-21T14:37:01.150Z

I'm a big believer in time boxed spikes where you report what you learned

1
jasonbell 2020-12-21T14:40:21.150100Z

Yeah I’m a bot 😉

raymcdermott 2020-12-21T15:18:06.151600Z

Time boxed spiky things can be good for 2-5 days after that it’s something else

1👍
val_waeselynck 2020-12-21T15:21:53.153800Z

Simulated Annealing-Driven Development : start with a strong bias towards experimentation, then cool down to a stable, proven optimum :)

raymcdermott 2020-12-21T15:32:08.154600Z

thats just sad with another :D

raymcdermott 2020-12-21T15:32:56.155200Z

I mean, you’re not wrong

raymcdermott 2020-12-21T15:34:40.156500Z

i prefer continuous experimentation … but maybe not on all part of the architecture all at the same time :)

dominicm 2020-12-21T17:24:26.157500Z

I'm a very negative person, I'm great at finding problems. Good solutions take me a long time though.

1🙊
2020-12-21T17:31:34.157600Z

that is what an op would say

val_waeselynck 2020-12-21T17:56:21.157800Z

SADDLE: Simulated Annealing Driven Development for Learning with Expediency I'd ride that, despite the non-definite curvature

1😂