1. 2

    My team is about to launch a product and we need an on-call schedule. We have a mix of backend/frontend/full-stack/junior/senior people, so I used Clojure and core.logic (a miniKanren impl.) to write a logic program to generate an on-call rotation that meets all our requirements.

    1. 2

      This is a nice little guide. And one would hope eventually someone will package this up into a lein plugin that is something like lein binary.

      I watched a tech talk about GraalVM a few months ago that indicated that, though this is probably one of the best options for making Clojure code into native binaries, there are some caveats. This guide doesn’t cover any caveats but I’m sure they still exist. Anyone know a link that details what they are?


      Also, someone I know has built a similar guide for shipping Clojure binaries, but relying instead on ClojureScript and Node. Obviously this is a very different set of tradeoffs. You can see that here:

      https://github.com/rduplain/hello-cljs

      1. 6

        And one would hope eventually someone will package this up into a lein plugin

        I made a Leiningen plugin for this: https://github.com/taylorwood/lein-native-image

        This guide doesn’t cover any caveats but I’m sure they still exist.

        There are many caveats when it comes to AOT compiling Clojure, not least of which is sacrificing a lot of run-time dynamism because native-image compilation is “closed world” — pretty much everything about your program must be known at compile-time, which is somewhat counter to Clojure’s design goals. Clojure 1.10 (or essentially anything that uses the current locking macro) doesn’t compile without a patch. The lein-native-image README has some caveats and examples with workarounds.

        I made a similar utility for deps.edn projects https://github.com/taylorwood/clj.native-image, and a little template for making CLI tools https://github.com/taylorwood/clj.native-cli.

        1. 2

          there is a lein-native-image plugin actually

          1. 2

            Ah, excellent. And this project’s README does include a Caveats section!

        1. 18

          I once gave a talk about what makes a successful abstraction layer and evaluating ORMs as an abstraction layer (similar to the pros and cons in this blogpost).

          I think what makes ORMs more popular than they probably should be is that the benefits are front-loaded while the drawbacks appear when you’ve already invested considerable amount of effort into working with one.

          Long story short, I consider ORMs a flawed abstraction layer because they make things more opaque (performance, data representation that you actually care about), coupled to a framework/library (it inevitably happens that once a project starts using an ORM you have a hard time understanding meaning in data without always using those classes describing your data, in effect binding you to that ORM), and when inevitably you end up needing to understand and work with SQL anyway in some cases, you end up with Claw crane syndrome: ever tried using one of these to get your prize instead of just using your hands? Yeah, ORMs feel a lot like that sometimes.

          When you have a small application/service/project with a single programming language (and one of the better ORMs), where you don’t mind that the data/performance/object model is strongly fused together, then it’s an okay choice. For anything else, it might be more painful.

          SQL itself in comparison is probably a much better abstraction layer, even with it’s own imperfections.

          1. 9

            I think what makes ORMs more popular than they probably should be is that the benefits are front-loaded while the drawbacks appear when you’ve already invested considerable amount of effort into working with one.

            This has been my experience with every ORM I’ve come across. The time/effort savings is an illusion, and (in my experience) by the time that illusion fades you’ll never get the time to factor the ORM out of your project. I got so frustrated working on a Scala project that uses Slick recently, I did a little write-up.

            1. 3

              I find this quite interesting. A year or two ago, I decided to investigate all database wrappers in different languages that seemed better than a regular ORM, and Slick was one that seemed (for a while) to me to get things right. (Although Quill looked even better.) But in the end I came to the conclusion that all but the thinnest wrappers are a waste of time in general, and I’ve increasingly taken a database-centric approach, using SQL and the database’s capabilities to the fullest extent without wrapping them up in layers of poorer abstractions.

          1. 7

            I’ve been working the problems in Clojure again but looking for opportunities to use Quil/Processing to make animated visualizations of the solutions:

            1. 1

              Day 4: https://www.youtube.com/watch?v=9OfLNCWM_yA

              Each guard gets a unique color, their naps are overlaid as slices on a clock face, and the extending lines’ lengths and colors are proportional to how often the guards were sleeping during that minute.

              1. 1

                Might you open source your visualization code please? I’m also working in Clojure and knowing how to visualize the data might be a step up from my current stare-at-maps method

                1. 1

                  Absolutely, it’s all here https://github.com/taylorwood/advent-of-code

            1. 5

              I’ll be traveling home from my first Strange Loop conference, which was amazing.