Our mission at Tagged is to win social discovery, and in order to accomplish this we need robust server technology. The programming language Clojure reduces the risk in developing concurrent server software to help make this possible.
Clojure is a functional language that was designed to run on a JVM (Java Virtual Machine) and has language support for multi-threaded programming. It integrates seamlessly with Java. It is a dialect of Lisp and, as such, is easily extensible. A relatively new language, Clojure nevertheless has a large, growing, and enthusiastic user community. It is used on servers as a replacement for Java in highly concurrent environments, or as a general-purpose functional programming language.
Clojure is the most important development in the Lisp world since the development of Scheme in the 1980s. It solves several long-standing problems with Lisp in enterprise settings. First, it solves the foreign-function interface problem by running on the JVM, giving it access to the entire universe of Java libraries. Additionally, it solves the Lisp data structure problem by introducing vectors, maps and sets that implement a common sequence (first, rest, cons) interface like classic Lisp lists. Previous dialects of Lisp have been based on this list data structure and have added vectors and maps as afterthoughts that do not share the same access interface and don’t necessarily nest; Clojure lists, vectors, maps, and sets nest arbitrarily. Lastly, it is functional by design (previous Lisps have been functional by convention) and all the data structures are immutable and persistent. This makes code much more robust because objects, once created, can never be modified. Although new, modified versions can be cheaply created from old versions, the state of an object can never be modified “out from under you,” making syntax like public, private, protected, volatile, WeakReference, synchronized, getters, and setters superfluous.
When a new version is created from an old object, the new version shares the unchanged part with the old object; it doesn’t duplicate the unchanged data from the old object. Objects that can be shared by different threads are confined to three different reference types (vars, atoms and agents) that can only be accessed through controlled functional interfaces.
Clojure greatly reduces the risk involved in developing multi-threaded software. Concurrent programming in Java is notoriously difficult to get right, and even worse to maintain. Bugs can hide in seemingly correct code only to appear at random times, and working code can be easily broken if a maintainer forgets a volatile modifier or synchronized block. Clojure makes writing robust, bug-free, and concurrent software mind-blowingly simple.