Posts tagged "Clojure programming language"

Clojure: A Dynamic Approach to Functional Languages

In 2007, an ambitious Rich Hickey introduced Clojure to the public. This programming language was a result of Hickey’s desire to create a Lisp language that, unlike other languages at the time, had a combination of a few things—defaulted to utilizing immutable data structures, was compatible with the JVM (Java Virtual Machine), and that incorporated concurrency.

Introducing Clojure

Clojure is many things, including dynamic, compiled, and general-purpose. Major corporations such as Walmart and Amazon use it in their systems. One important element to Clojure is that it is part of the Lisp family. Lisp is defined as a group of programming languages based on mathematical notations. Clojure itself utilizes some of the Lisp features like its incorporation of parentheses and an abstract syntax tree.

Benefits of Clojure

  • Utilizes Functional Programming (FP)
  • Isolates side effects
  • Dynamically-typed
  • Data is immutable by default
  • Declarative-based coding

Polymorphism

This is when data types are processed inside a uniform interface. It works with Object-Oriented Programming (OOP) languages, multimethods, and protocols as well. Clojure supports this development tool, allowing it to write functions that can be used in many different data types.

Concurrency

Hickey wanted Clojure to be concurrent-friendly, or to be able to process various tasks at one time, to decrease development time. In order to support this as much as possible, Clojure has a Software Transactional Memory, or STM, dynamic components which separate state changes inside threads, and allow for synchronous—as well as asynchronous—manipulation.

ClojureScript

Simplified to CLIS, this can be viewed in a similar way to how Java and JavaScript function together. In fact, CLIS has the ability to compile code into JavaScript, which lets developers run apps on mobile devices and across various browsers. It’s backend compatible through Node.js too. Tools and features within CLIS like re-frame and Reagent has integration capabilities with React and React Native. Other features of it include a core. async library and Figwheel.

Summary

There are certainly some similarities between Clojure’s branch tool, CLIS, and Java, JavaScript, React and React Native. However, it’s the language’s other features that set it apart from most programming languages currently available. Its creator, Rich Hickey, wanted to intentionally create a language that was different from all the others. A significant difference was Clojure’s default of immutable data structures. It also demonstrated fast load times, high-quality performance, and other features or functions that developers loved in the language’s competition.

More technical, specific functions of Clojure—how it handles polymorphism, side effects, and Functional Programming—further separate it from languages like Java and Python. Even in modern technological society, Clojure is, in many ways, still very unique. While other languages do have the general quirks that make them better suited for certain projects over others, Clojure can be viewed a step further through its technical features.

One thing won’t change when deciding what programming language to use for a development project—the need to identify which language is the better fit. Maybe it could be Clojure, or it might be a more general programming language.