4 ms·
we have a clojure codebase that's about 100k lines. Honestly I'm kinda fed up with it. Certain 3rd party libs we've used have been abandoned. We wrote our o
by fnord77 5y ago
we have a clojure codebase that's about 100k lines. Honestly I'm kinda fed up with it. Certain 3rd party libs we've used have been abandoned. We wrote our own libs for a major framework and it is failing behind.
Too many "I'm very clever" functions that are hard to understand and also have subtle bugs.
- ashes-of-sol 5y agoWould you mind sharing the abandoned libs/framework? When you say you have too many "I'm clever" functions, do you mean within code your team wrote, or in the ecosystem at large?
- fnord77 5y agoit is a couple of the clojurewerkz libs. the "I'm very clever" defns and macros that I'm referring to were written by our team. Most of the 3rd party libs are pretty good. Except for them being not maintained and not keeping up with the latest versions of databases, etc.
- dragandj 5y agoI wonder if they'd be abandoned if companies using them considered these 3rd party libraries valuable enough to contribute/fund the development.
- coneill 5y agoSeconded. I work in a clojure codebase that were trying to get out of. There's just dead libraries everywhere and stuff that maintained by one person that gets no updates at all. That or we just end up making functional "wrappers" around Java libraries and at that point we might as well just write straight Java. Also yea everyone wants to be so damn smart having macros within macros within macros that no one knows what the original intent of the code is anymore. The repl based development I find also breeds a really bad mentality of forgoing building a deployment process and instead people just repl in and make a bunch of changes and prod rarely matches whats checked into github.
- raspasov 5y agoI've been using Clojure for almost 10 years and writing macros has always been discouraged in the community. You don't see too many of them in the wild, and for good reasons. If you're writing macros on a daily basis, you better have a really good reason for it.
- coneill 5y agoThe codebase im in is 10+ years old and macros are everywhere. Were macros a super hyped at one point in the past? I'm fairly new to Clojure just by virtue of being part of this system rewrite but I see stuff everywhere in the code im working in like in the article where there just seems to be macros that accomplish nothing except obscuring already built in constructs for the sake of maybe saving a few lines of code or combining one or two statements into one macro. Its maddening to just be constantly mentally unpacking this stuff and searching through docs only to find out "Oh its not a clojure thing, someone wrote a macro for this"
- raspasov 5y agoNo, I don't think they were hyped at any point. They are used in certain libraries like https://github.com/ptaoussanis/timbre https://github.com/ptaoussanis/timbre but for things that are simply not possible without macros, for example (timbre/spy (+ 1 1)) will actually print both the expression and the result: DEBUG [ss.experimental.scratch:1] - (+ 1 1) => 2 This is one of my favorite debugging tools. IMO beats a debugger hands down! Printing can also be disabled with a global library flag without code modification. Perhaps if the macros are "simple" they can be unpacked relatively easily. I do understand how mentally challenging that can be for somebody who's just starting with Clojure. I've been using Clojure for a long time and only just recently became more comfortable with macros after I made a conscious effort in that direction. I'm still far from an "expert" in them.
- bgorman 5y agoI’m sorry you are having trouble with Clojure. One thing to keep in mind is that Clojure has excellent interop with Java, and it is trivial to write a small Clojure wrapper that just does critical thing for your dependency injection system e.g. startup and shutdown, and just pass through a reference to the Java object when you need to make function calls. Another thing to keep in mind is that Clojure code is extremely stable, so pure Clojure libraries often require minimal maintenance, and code written for Clojure 1.3 runs on 1.10 99.99% of the time with no modifications.
- raspasov 5y agoAre those "clever" functions pure?
- oh-4-fucks-sake 5y agoObligatory evangalism: Considered Kotlin as a JVM-lang-of-choice? We use it on all our backends and we really love it.
- fnord77 5y agoJava 16 is good enough for us.
- didibus 5y agoI think its a "to each their own" honestly. We use Java, Kotlin, Scala and Clojure, and of all four my favourite by far is Clojure. We also don't suffer from any of the problems mentioned above, had no issues with libraries and no one abuses macros or makes prod repl changes willy nilly, etc.
- Zelphyr 5y agoIt sounds like Clojure just isn't your cup of tea. Both of those problems exist in every other language I've ever used.