Clojure yaklaşımını tercih etmeniz gereken durumlar nelerdir ? Mevcut programlana dillerinin eksikleri Clojure ile giderilebilir mi ? Cevabı bu yazıda
I’m a Clojure newbie, but I work at Factual (company) where a lot of my peers have been using Clojure heavily for several years. I polled them for reasons why they think Clojure is worth learning and this answer is a summary of the their thoughts.
Why Clojure is awesome:
- Clojure is a JVM-based language which means you have full access to Java’s rich, mature API and the myriad of libraries that have been implemented for Java over the last 15 years.
- Clojure is a Lisp, so all of the advantages that apply to Lisps apply to Clojure. Here’s a good essay by Paul Graham describing some of the core values of Lisps: http://www.paulgraham.com
/diff.html (for a good discussion of this essay, see: http://stackoverflow.com/ questio…)
- Because “code is data”, you can do really neat things with macros. For example, some of Java’s hot new languages features included a for-each loop in Java 5 and a try-with-resources statement in Java 7; it would be fairly easy to write Clojure macros that extends Clojure to do the exact same things without having to wait for years for the next version of Java.
- Clojure is designed for concurrency. It offers immutable data structures, functional programming with zero side-effects, Software Transaction Memory built in, etc. You can focus your engineering efforts on features instead of concurrency details.
- Clojure is built for processing collections, which is great if you’re working with a lot of data. At Factual, we’ve gotten a lot of mileage out of Cascalog, which is a Clojure DSL for writing Map-Reduce jobs very quickly and compactly.
- Actually, Cascalog deserves its own bullet point. If you write Map-Reduce jobs, Cascalog will save you a lot of time and effort and boilerplate.
- Lazy data structures are built-in so you can focus more on writing uncomplicated code than on performance tuning and efficiency.
- The interactive REPL makes development quicker and more fun. It also dramatically speeds up the learning process.
- In the words of one of smartest engineers I’ve known, “Rich Hickey [Clojure’s creator] is hella smart and thinks about the features deeper than most language designers, so the language is a result of great choices. Learning Rich’s approach will make you a better engineer and better thinker.” (See this video for insight into Rich’s approach: http://www.youtube.com/wa
- Well-designed DSLs can significantly benefit projects, and Clojure’s macro system gives you unprecedented power and flexibility when designing and implementing DSLs. Here are two good examples of what you can do: http://christophermaier.n
ame/blo… and http://sqlkorma.com/
- Quote from a Rich Hickey interview: “You can reach a point with Lisp where, between the conceptual simplicity, the large libraries, and the customization of macros, you are able to write only code that matters. And, once there, you are able to achieve a very high degree of focus, such as you would when playing Go, or playing a musical instrument, or meditating. And then, as with those activities, there can be a feeling of elation that accompanies that mental state of focus.” (source: http://www.codequarterly.
- Clojure has an enthusiastic, fast-growing community, and you will learn a lot if you decide to participate in it.
- If you are an employer, Clojure attracts smart people — exactly the kind of people you want to work for you (see http://www.paulgraham.com
/pypar….). Also, because there are not a lot of Clojure jobs (yet), you will stand out from other employers.
- The supply of Clojure programmers is not high, so knowing Clojure gives you a great advantage for any job where the language will be used.
- To quote one final Paul Graham essay, if you buy into the premise that Clojure can be a very powerful tool, then Clojure becomes like a secret weapon in a crowded, competitive market. See: http://www.paulgraham.com