Fork me on GitHub

Good Morning!


good morning


@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.

🙀 6
😎 3

(Reaction for windsurfing)

😂 3

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.


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.


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

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.


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.


good morning!


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 !!


Thankfully I didn’t think of code generation!


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.


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.


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.


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


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 :)


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.


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.

😂 6

No wrath @slipset just disappointment :)


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


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


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


Man point is that it was considered something of a trick


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


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

😂 6

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


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.


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.


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


Good morning


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

❤️ 3

@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.


I wish :). Depends on your db though.


@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)


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


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}))

😱 3

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

😂 3

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

👍 3

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


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?


@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.

💯 3

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


Yeah I’m a bot 😉


that is what an op would say


Damn, found out…….


> 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 🙂


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


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

👍 3

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


thats just sad with another :D


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

😂 3

I mean, you’re not wrong


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


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

🙊 3