10 ms·
Bringing Clojure programming to Enterprise (2021)
- rawoke083600 4y ago>This use-case has been achieved using a single Clojure variable. Can you expand more on how the business rules are executed with the variable ? Maybe a simple example ? Clojure-newbie looking to learn more :)
- dmichulke 4y agoEventually you want non-developers to develop business rules, so you come up with pseude-code like when X then do Y You can write them in Clojure like in the above example: [:rule [:when X] [:then Y]] which is kind of self-explanatory. X and Y can be any valid predefined expressions, e.g. [:rule [:when [:< amount 100]] [:then [:send-email-to-boss]]] If you had such a rule, you'd just parse that line as edn, substitute all symbols (check for injection attacks) and execute it. However, effectively clojure itself is most often the smallest representation: (when (< amount 100) (send-email-to-boss)) It's just not that readable because it's missing the "then", but it would be valid clojure right away. In the end it's like a code snippet that non-developers can write without having to set up a compiler, run-time, syntax-checker
- vincnetas 4y agofrom my experience im very sceptical each time when someone says that business people will write these rules. on paper it looks nice but at the end if rule is a bit more complicated developers end up writing or updating the rule while someone standing behind their back :)
- vamega 4y agoI’ve seen business people write rules in excel. A. lightweight dsl with a quick feedback loop (provided by a REPL in Clojure, and the UI of excel) seems to be key features to avoid ending up in the scenario you describe
- thih9 4y agoI’m noticing a lot of clojure posts recently. Has the language become more popular lately? Is there any reason behind it?
- lebski88 4y agoIt was the 15 year anniversary recently. But I think it's just general hackernews language waves. Someone posts something, it does well, other people get interested, find things post them and onwards.
- solaxun 4y agoNot sure on relative popularity. If you haven't already, you should try it! Here's why I like it: - Very consistent, easy to keep the whole language in your head - Stable, core rarely changes ("accretive only" mindset). - REPL - Focus on a handful of data structures which will solve 95% of the problems you face, rather than a deluge of complicated abstractions. - Excellent concurrency primitives - Access to Java libraries if a Clojure equivalent doesn't exist - Macros The only blemish for me was horrifically bad error messages.. other than that it's near perfect.
- rawoke083600 4y agoVery accurate ! and x1000 about the error message !
- japanman425 4y ago>easy to keep the whole language in your head Is that not all programming languages. Practically have identical syntax for the problem they are solving. The thing which differs is “standard” libraries, which is not part of the language but a side effect of.
- danuker 4y agoPython: - functions - classes - list comprehensions - generators - inheritance - operators - string interpolation (a handful of syntaxes) - module system hard to wrap your head around - async (I think async is a workaround for getting more done with one thread because of the GIL). Pointless on machines with increasing number of cores. Just get multithreading right (and I want to learn Clojure's model - focusing on immutability) and you will not need async. Python can barely share memory across threads. I'm not sure you can get by without serialization.
- moomin 4y agoI’ll note this article could have been written ten years ago without changing a word. If you’ve already made your mind up about Clojure, there’s very little going on that’s going to move that needle.
- deleted 4y ago[deleted]
- john-shaffer 4y agomalli, specter, and calva are all less than ten years old. Clojure has seen a lot of progress in tooling and libraries.
- TacticalCoder 4y agoAnd now you get Clojure Babashka scripts too, which starts in milliseconds (thanks to Babashka being compiled using GraalVM). So with Clojure you get ClojureScript and "shell" scripts too now!
- ldh0011 4y agoI just recently started using Babashka and it is great, excellent productivity boost for text manipulation scripting tasks.
- fulafel 4y agoTime and staying power actually are actually prime movers of the needle. Ten years ago it was a 5 year old language, hadn't seen the 15 years of dev community evolution, ClojureScript was just out of the oven and relatively unproven, and unlike then Clojure now seems to clearly pull ahead in mindshare over Scala, etc.
- cutler 4y agoClojure ahead of Scala? In which universe? Go to any jobs site such as Indeed.com and you'll find Scala jobs outnumber Clojure by about 10 to 1.
- college_physics 4y agoInformative, no-nonsense account. Would be cool to have more such contributions from 'non-tech' industries as a counterbalance to the drama and hyperbole and hidden agendas of the usual suspects
- japanman425 4y agoTyre manufacturing very much is not “non-tech”…
- missedthecue 4y agoI don't think he means that literally zero technology is used in tire manufacturing. What he's saying is that it's interesting to see these languages and concepts applied to old economy industries, which tire manufacturing certainly is.
- im_down_w_otp 4y agoI suspect they mean from use cases that aren't so centered around software for its own sake. Use cases where the rubber meets the road, as it were.
- SOLAR_FIELDS 4y agoJoke aside, yeah, hearing about interesting tech being used outside of breathless, infinitely scalable, VC funded tech bubble companies is usually quite compelling
- im_down_w_otp 4y agoLike your namesake for instance :-) I started a company that deals primarily with "cyber-physical systems" use cases in-part because I ceased to find anything remotely resembling "software for its own sake" to be compelling anymore (in an existential sense). Also, if you do happen to work in solar farm tech, I'd love to chat. nathan@auxon.io
- college_physics 4y ago
- brundolf 4y agoI don't use Clojure and I probably never will, but I love seeing the way it's been kind of a jailbreak moment for Java programmers trapped in enterprise practices. It was laser-focused to give specifically those people access to a whole lot of highly-productive and pleasant language features, wrapped up in a package that enterprise management could be amenable to. It seems like it succeeded in liberating a bunch of people at their real jobs, which is cool to see
- jcadam 4y agoI've had a couple of jobs doing Clojure full-time, the problem is that Java jobs pay better.
- ARandomerDude 4y agoThere's good reason to doubt that claim. https://survey.stackoverflow.co/2022/#section-top-paying-technologies-top-paying-technologies https://survey.stackoverflow.co/2022/#section-top-paying-tec...
- vasac 4y agoUsual response to that is that there's a skew in Clojure related data as its community consists of mostly experienced devs. I know it's anecdotal evidence but I'm doing Java right now because I couldn't find a Clojure job that pays nearly the same (and I already used Clojure for 5 years in production environment).
- winrid 4y agoLol, love how high Crystal is on that list. You can get Crystal jobs now?
- capableweb 4y agoOnce you get experienced enough, you can include a "only program in X" and still get hired :)
- 4y ago
- deleted 4y ago[deleted]
- notamy 4y ago(2021)
- danuker 4y agoLooks like they were still using it in December last year. https://blogit.michelin.io/an-introduction-to-datalog/ https://blogit.michelin.io/an-introduction-to-datalog/
- rbanffy 4y agoHow well would Clojure fit into a Spring Boot centric environment?
- joe-user 4y agoClojure can fit quite well into Spring Boot-centric environments! I've added Clojure to several legacy Spring Boot apps, and the fact that it can be introduced as "just a library" made that portion a snap. If you're not trying to access resources related to Spring Boot's dependency injection, it's pretty straightforward to call into Clojure from Java. If you _do_ want access to DI resources, there's a small amount of code required to wire things up, though it took me a while to find out what that code was, mostly because it requires access to portions of Spring Boot that are not typically user-facing. Since I had hooked Clojure up to the Spring apps, I also set things up so I could SSH onto application servers, then get a REPL via a socket server into the applications themselves. Being able to check and sometimes change the state of the application live at runtime was like a superpower. This proved extremely valuable, often for debugging errors in the Java portions of the code, but also for situations like final design tweaks live with a client in a development environment. Client asks to bump a font size or change a color or adjust a border or change some copy, then I make the change in my editor, send it over the socket REPL, tell the client to refresh, and repeat. When done, I would simply save, commit, and would be confident that it's what the client was after. The only downside is that I'm no longer at a shop that uses Clojure, and feedback loops for production debugging or letting clients see their decisions are measured in days or weeks when possible at all, not seconds or minutes. I will admit that connecting to a running application is dangerous, but so is what many surgeons do, and we are certainly not going to ask them to turn in their scalpels. By being conscious of the "great power; great responsibility" bit, I was able to come out mishap-free. On the other hand, when I had to create new projects where I thought Clojure would be a good fit, I just went all-in with the Clojure ecosystem rather than start with Spring Boot and add Clojure, and I found going all-in with Clojure to be incredibly productive. With that being said, I made the decisions with a decent understanding of both Spring Boot and Clojure, so my experience would likely vary from that of someone who is experienced with Spring Boot and knows nothing of Clojure.
- jcadam 4y ago
- n-gt 4y agoI actually quitted a job in 2017 because I was so hyped around my discovery of clojure in 2016 and wanted to write some piece of code that was gonna parse some JS code and spit out some other JS code. (I quitted cuz I never got the project done and my manager was like hey man it's been 5 months do you have any updates and I'm like hey I've been rewriting the same thing over and over again while hopping between 5 different editors and 3 different build tools and to be honest all I've done is learning emacs for the past month). I don't know if things have improved but back then everything felt either a WIP or obsolete. You wanna use lein to build but apparently that's ancient and you really should be using this other build tool that's not fully integrated with any editor other than emacs and hey while you are at it the Clojure team has released their own dependency management tool and you really should be using that instead. By the way who uses intellij when there is VS Code? Clojure boasts about it's strong Java interop and ability to use the existing Java ecosystem but it has one of the worst intellij integrations, using a 3rd party plugin that is either broken or not working with your build tooling. Oh did you say you wanna use Gradle or Maven to build your Clojure stuff? You could actually do it, funny guy. The language is probably the most practical lisp out there, but it also brings all the artificial lisp superiority syndrome with it (and forces you into submitting the rest of your life to emacs in praise of lisp culture). You think you'll pick it up quickly and be productive but juggling between learning all the build tooling, the language itself, editing lisp and integrating all those 1-man libraries that are scattered all over github, you end up losing weeks if not months on fixing boilerplate. I would give it another go but now that I think about debugging a Clojure app in runtime and making sense of a reflection-based, dynamic language on top of JVM, I'm like naaah I already have enough stress-induced grey hairs... Haskell gives me the pure functional kick that I want, and the rest I can deal with in Kotlin or even Java 11.
- japanman425 4y ago>artificial lisp superiority syndrome I giggled at this. Regularly, and in this thread, whenever some DSL req or LISP is mentioned you get these holier than thou comments about how LISP is the best thing since sliced tomatoes.. similarly with diehard vim/emacs users.
- 4y ago
- speed_spread 4y agoMakes total sense once you learn that parentheses are all little tyre cutouts bouncing around.
- julienfr112 4y agoThe bibemdum himself should be clojure's mascot !
- deleted 4y ago[deleted]
- simula67 4y agoThere is nothing specific to tyre manufacturing in this article. The original title was more informative: "Bringing Clojure programming to Enterprise"
- dgb23 4y ago> A first element of decision lied in the fact that our product used a great number of data structures and business management rules which aim to evolve very frequently and be adapted to new business contexts over time. They seem to have a very good use case for Clojure adoption. The article mentions many of the affordances Clojure gives you for data oriented, information processing problems. But one of the unsung heroes of Clojure is the namespaced keyword: If you’re already working in a FP, data oriented style but in a language that doesn’t have them, I recommend you have a go with Clojure and explore them. It’s such a simple construct that gives you a lot of leverage in terms of semantics, code organization, flexibility and validation. Think of them as having characteristics of uuids, URLs, URNs etc. they stand on their own and have meaning across system boundaries. It’s very nice and calming to have that in-built as an everyday construct.
- rawoke083600 4y agoNever heard a lang-feature describe as "calming" but now that I think about it, you are very much right :D
- simongray 4y agoSeveral Clojure/Datomic design decisions are directly inspired by RDF.
- mpweiher 4y ago> But one of the unsung heroes of Clojure is the namespaced keyword: Sounds intriguing, can you say more?
- dgb23 4y agoI'll do my best but there might be better explanations around the web. I think an illustrative example would be this repo: https://github.com/cognitect-labs/anomalies https://github.com/cognitect-labs/anomalies These are basically re-usable, namespaced keywords. You might decide to use them or something similar in your program/system and some people do. Pretty neat: Their semantics are documented in the readme and the little bit of code in the repo defines a spec here https://github.com/cognitect-labs/anomalies/blob/master/src/cognitect/anomalies.cljc https://github.com/cognitect-labs/anomalies/blob/master/src/.... You can read it as: any map that has these keywords as defined in the spec is an "anomaly". Specs are open, non-exclusive so you can add more stuff to your structure and they still conform. (Note that the double colon before the keywords just mean "the current namespace defined at the top".) Note that you don't need to define a spec for namespaced keywords. It's just a utility that leverages them. By themselves they already say "I can be used in a global context". --- These keywords can be used from anywhere and by themselves. You don't need to carry around their context for them to work or have meaning. To contrast: for example a JSON field in a nested context might only make sense in that specific nesting context. Clojure namespaces are by convention globally unique. Some examples: - `:my.domain.accounting/refnumber` - `:my.domain.ui/color` defined as `(or :my.domain.ui/rgb :my.domain.ui/hsl)` etc. - `:my.domain.person/name` defined as a string if at all - `:my.domain.event/type`
- deleted 4y ago[deleted]
- silcoon 4y agoIt's really nice to see Clojure being adopted more and more by large companies, showing big results not only for statups. Clojure has been designed with this in mind, to let the old Lisp mindset behind. The same author also publish a introductory article about datalog. Check it out!
- Wonnk13 4y agoI haven't really looked at clojure since 2015? maybe. Nice to see that it's still around. I've never worked with a LISP in a professional setting, but like Haskell it's fun to play around with once and a while.
- tragomaskhalos 4y agoI wonder if Groovy doesn't allow one to produce a more user-friendly DSL, whilst retaining the benefits of integration with the java ecosystem? No strong personal opinion here, but have been coincidentally reading up on Groovy and mentally retrofitting to DSL I did in Ruby a while back.