TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Structuring Clojure applications

198 点作者 nefreat超过 2 年前

11 条评论

twawaaay超过 2 年前
I love Clojure and also Common Lisp (basically, Lisp in general). But I also observed every single corporate Clojure project I had any connection with to fail spectacularly. Typically as a complete unmaintainable mess. Some as unmaintainable mess that is very slow and unreliable.<p>My theory is that this is result of no guardrails on how to structure your application. Clojure to be productive must be used by people who absolutely know what they are doing when it comes to structuring your app.<p>When it comes to Java you get hordes of devs still producing passable results. The structure is largely imposed by the frameworks (mostly by Spring&#x2F;Spring Boot) and available help, literature. Even some antipatterns at the very least achieve some level of convention&#x2F;predictability that is needed to be able to find your bearing around the codebase.<p>I would say, if you have a normal-ish project, care about productivity but don&#x27;t have really stellar and mature developers -- skip Clojure.<p>Choose Clojure if you know how to use all that additional power, have need for it and understand what your added responsibilities are.<p>If you don&#x27;t know how to wield Clojure&#x27;s power there is very little you can gain by choosing it but a lot to loose.
评论 #34056779 未加载
评论 #34055297 未加载
评论 #34056108 未加载
评论 #34057928 未加载
评论 #34054918 未加载
评论 #34054992 未加载
评论 #34055455 未加载
评论 #34054894 未加载
评论 #34059731 未加载
评论 #34055586 未加载
评论 #34054913 未加载
评论 #34062849 未加载
评论 #34057579 未加载
评论 #34057074 未加载
评论 #34055071 未加载
评论 #34067169 未加载
TacticalCoder超过 2 年前
A similar post, also mentioning protocols and integrant, was posted here a few days ago and may also interest some:<p><a href="https:&#x2F;&#x2F;mccue.dev&#x2F;pages&#x2F;12-7-22-clojure-web-primer" rel="nofollow">https:&#x2F;&#x2F;mccue.dev&#x2F;pages&#x2F;12-7-22-clojure-web-primer</a>
rmuslimov超过 2 年前
This is very informative and beginner friendly write up which came be used as strategy for organizing apps in Clojure. I personally have something very similar which Redis storage used as persistent storage for storing jobs and tasks within workflow are potentially executed on diff hosts. I would recommend to extending this topic and share your thoughts about component&#x2F;mount like abstraction to the code. For example notify-sender should have credentials to connect to the services. How they are delivered? as input to the :handle-action method or as as component&#x2F;mount. Interesting to learn about your approach here.<p>Thanks for sharing!
评论 #34065051 未加载
dig1超过 2 年前
I am not fond of the multimethods because they can easily tangle the code and give you a false sense of scalability. For example, in a blog post, &quot;handle-action&quot; is nicely decoupled with 3 different actions, but let&#x27;s imagine how that will look after someone adds 20 new actions. Good luck debugging that.<p>Also, I saw numerous cases where people will copy&#x2F;paste multimethod arguments without knowing what they are used for.<p>I still find case&#x2F;cond more readable and way more performant, especially since the author uses the same type for a multimethod dispatch, but YMMV.
评论 #34054927 未加载
评论 #34056167 未加载
评论 #34054887 未加载
haolez超过 2 年前
I&#x27;m an experienced developer and I&#x27;m getting the feeling that advanced languages are getting less relevant for most applications, since you usually just need a little glue code to glue together mainstream solutions or managed services. I don&#x27;t need the power of Clojure to connect SQS to Lambda with some extra custom logic.<p>But Clojure does look amazing :)
评论 #34053773 未加载
评论 #34054606 未加载
评论 #34053785 未加载
评论 #34076518 未加载
dwohnitmok超过 2 年前
It&#x27;s interesting to see a lot of FP communities independently arriving at the same architectural structures. See e.g. Haskell&#x27;s &quot;handle:&quot; <a href="https:&#x2F;&#x2F;jaspervdj.be&#x2F;posts&#x2F;2018-03-08-handle-pattern.html" rel="nofollow">https:&#x2F;&#x2F;jaspervdj.be&#x2F;posts&#x2F;2018-03-08-handle-pattern.html</a>
评论 #34053685 未加载
logistark超过 2 年前
For me, protocols i tend to not use it, because it makes it harder to understand the code and Cursive cannot find instances that implements the protocols.<p>For testing purposes is easier to redef a function than implementing a full new test protocol.
评论 #34053735 未加载
nkh超过 2 年前
Any one tried Polylith with the multi-method approach mentioned in the article?
the-alchemist超过 2 年前
It seems like a lot of the anti-Clojure sentiment boils down to 1) lack of static typing, 2) poor IDE support.<p>I&#x27;m wondering, though, doesn&#x27;t the same apply to Ruby, Python, and Node projects?<p>I&#x27;ve over-hauled 80k line Python projects, and the &quot;lack of typing&quot; there seemed to apply as well.<p>Why don&#x27;t Ruby, Python, and Node projects suffer from the same critique? Genuinely curious...
评论 #34072021 未加载
shaunparker超过 2 年前
I haven&#x27;t looked at Clojure in a bit, but shouldn&#x27;t the (nil? to-info) check in the transfer implementation of handle-action come first? It seems like that would never be reached in the current implementation.
评论 #34065067 未加载
beders超过 2 年前
This approach is not simple. It complects a business process state with multi-methods. Don&#x27;t do it.<p>Model state where it belongs: in a database.
评论 #34056710 未加载