开发者

What are the best use cases for using Clojure for new development? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 12 years ago. 开发者_开发问答

Why should I choose Clojure over another language for a new project? In what areas does it excel?


Some scenarios where I would use Clojure:

  • You are building a new, highly concurrent application that needs to scale reliably. In my opinion, Clojure's concurrency features (STM, immutability-by-default, lock free MVCC) are the best of any major language at present. Rick Hickey's excellent video about Identity and State is a great way to get a feeling for this.

  • You are a Java-based shop that wants a productive dynamic language that can be used for rapid development or scripting while maintaining your investment in a large Java code base. I've found Clojure pretty effective at "gluing together" Java code since the interop capabilities are extremely good (and simple!).

  • If you want to use a functional programming language Clojure is pretty good (it's not quite as "pure" as Haskell but has all the key features - first class functions, higher order function composition, immutability, laziness)

  • If you work in a field where there is a major need for code manipulation (compilers, DSLs, natural language processing, genetic programming), where the LISP "code is data" philosophy enables you to be extremely productive. This is a sweet spot for homoiconic LISP based languages in general.


At the risk of providing exactly the sort of reductive non-answer that Devin is referring to: I chose Clojure because I like the functional programming style and Clojure lets me do that on the JVM and interop with lots of existing code that runs on the JVM.

So the question then becomes: Why functional programming?

Immutable state - lack of side-effects, easier testing, better support for concurrency (and, in future, parallelism).

Small, functional components that can be easily reused and composed to construct large, flexible systems.


it's very hard to find clojure developers so I would stay away from it if you work for a big company and stick with java or .net. it's more a political than technical decision in large companies. if however you are building your own product then clojure is very fast to develop in and can get you to market faster.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜