Live data from Hacker News

Six Years of Professional Clojure

engineering.nanit.com

1–10 of 254 posts

Re: Six Years of Professional Clojure

#3
I found one of the perceived weaknesses of Clojure (in this article), it being dynamically typed, is a tradeoff rather than a pure negative. But it applies that tradeoff differently than dynamic languages I know otherwise and that difference is qualitative: It enables a truly interactive way of development that keeps your mind in the code, while it is running. This is why people get addicted to Lisp, Smalltalk and similar languages.

> To understand a program you must become both the machine and the program.

- Epigrams in Programming, Alan Perlis

Two of the big advantages of (gradually-) typed languages are communication (documentation) and robustness. These can be gained back with clojure spec and other fantastic libraries like schema and malli. What you get here goes way beyond what a strict, static type systems gets you, such as arbitrary predicate validation, freely composable schemas, automated instrumentation and property testing. You simply do not have that in a static world. These are old ideas and I think one of the most notable ones would be Eiffel with it's Design by Contract method, where you communicate pre-/post-conditions and invariants clearly. It speaks to the power of Clojure (and Lisp in general) that those are just libraries, not external tools or compiler extensions.

Re: Six Years of Professional Clojure

#4
post #3

I found one of the perceived weaknesses of Clojure (in this article), it being dynamically typed, is a tradeoff rather than a pure negative. But it applies that tradeoff differently than dynamic languages I know otherwise and that difference is qualitative: It enables a truly interactive way of development that keeps your mind in the code, while it is running. This is why people get addicted to Lisp, Smalltalk and si…

Agreed. I feel Lisps and SmallTalk are dynamic done right. I think the other language features that you use also influence the value from dynamic or static types. For OOP style, static types are a huge asset for refactoring and laying our architecture. On the other hand, immutable data and stateless functions (as idiomatic in clojure) make them less necessary, and also work great together with interactive development.

Re: Six Years of Professional Clojure

#5

What build tools do you use, maven?

Not the author, but most clojure projects use leiningen to build and distribute projects (https://leiningen.org/)

This seems to be the case for the author's open-source work (https://github.com/nanit/kubernetes-custom-hpa/blob/master/a...)

Re: Six Years of Professional Clojure

#6
One thing I don't like about all articles on clojure is that basically all of them say: ah, it's just like lisp with lists `(an (example of) (a list))` with vectors `[1 2 3]` thrown in. So easy!

But then you get to Clojure proper, and you run into additional syntax that either convention or functions/macros that look like additional syntax.

Ok, granted, -> and ->> are easy to reason about (though they look like additional syntax).

But then there's entirely ungooglable ^ that I see in code from time to time. Or the convention (?) that call methods on Java code (?) with a `.-`

Or atoms defined with @ and dereferenced with *

Or the { :key value } structure

There's way more syntax (or things that can be perceived as syntax, especially to beginners) in Clojure than the articles pretend there is.

    (defn ^:export db_with [db entities]
      (d/db-with db (entities->clj entities)))

    (defn entity-db
      "Returns a db that entity was created from."
      [^Entity entity]
      {:pre [(de/entity? entity)]}
      (.-db entity))

    (defn ^:after-load ^:export refresh []
      (let [mount (js/document.querySelector ".mount")
            comp  (if (editor.debug/debug?)
                    (editor.debug/ui editor)
                    (do
                      (when (nil? @*post)
                        (reset! *post (-> (.getAttribute mount "data") (edn/read-string))))
                      (editor *post)))]
        (rum/mount comp mount)))

Re: Six Years of Professional Clojure

#7
Great article, love Clojure. Was trying to figure out what Nanit does. Might want to consider putting a link to the Nanit homepage on your engineering page. When just typed in nanit.com and saw the baby monitor tech, I thought maybe I went to the wrong place, until I saw the logos matched. Anyway, good read, but please put a link to your home page on your engineering site, or, put a 1 liner in the opening of your blog giving context to what your company does.

Re: Six Years of Professional Clojure

#8
post #6

One thing I don't like about all articles on clojure is that basically all of them say: ah, it's just like lisp with lists `(an (example of) (a list))` with vectors `[1 2 3]` thrown in. So easy! But then you get to Clojure proper, and you run into additional syntax that either convention or functions/macros that look like additional syntax. Ok, granted, -> and ->> are easy to reason about (though they look like addit…

Not sure how you’re supposed to find this page, but it’s pretty useful: https://clojure.org/guides/weird_characters

Re: Six Years of Professional Clojure

#9
post #8
post #6

One thing I don't like about all articles on clojure is that basically all of them say: ah, it's just like lisp with lists `(an (example of) (a list))` with vectors `[1 2 3]` thrown in. So easy! But then you get to Clojure proper, and you run into additional syntax that either convention or functions/macros that look like additional syntax. Ok, granted, -> and ->> are easy to reason about (though they look like addit…

Not sure how you’re supposed to find this page, but it’s pretty useful: https://clojure.org/guides/weird_characters

Nice! I missed it (or it didn't exist) when I last looked at Clojure a few years back

Re: Six Years of Professional Clojure

#10
post #6

One thing I don't like about all articles on clojure is that basically all of them say: ah, it's just like lisp with lists `(an (example of) (a list))` with vectors `[1 2 3]` thrown in. So easy! But then you get to Clojure proper, and you run into additional syntax that either convention or functions/macros that look like additional syntax. Ok, granted, -> and ->> are easy to reason about (though they look like addit…

Single engineers will pick clojure at companies , build a project in it, later that engineer will move on, now nobody can maintain this code so it’s rewritten in some normal language. I’ve seen that happen a few times. That code is hard to read and understand. This is why clojure will remain niche.
Post reply on HN