Is Clojure the Start of a New Era in Functional Programming?

Data science never fails to captivate me. I am endlessly amazed by the opportunities it provides and the valuable insights that can be gleaned through statistical analysis. In my free time, I enjoy exploring the StackOverflow developer survey to detect any irregularities and acquire fresh viewpoints. In 2023, an example of this would be none other than Clojure.

Clojure, authored by Rich Hickey, has been compared to “Lisp for the Java Virtual Machine”. Its speed and adaptability have been emphasized, indicating that it equips developers with the means to produce resilient code.

Let us examine the data:

  • Considering that only 2.25 percent of respondents use Clojure, the findings of the StackOverflow study are not particularly unexpected.
  • Clojure is ranked second in terms of user satisfaction, just behind Rust, with 81% of its users endorsing it.
  • A Clojure developer can expect to earn an average annual salary of roughly £70,000, with F# (another functional programming language) following closely at around £64,000.

Upon my initial inspection, Clojure piqued my interest. It seems that due to the limited number of developers available, there is a high demand but low supply, resulting in increased costs.

According to the findings of the 2023 State of Clojure survey, 65% of respondents with development expertise have been working in the field for a minimum of six years. This is a noteworthy percentage, especially when taking into account that half of the respondents are over the age of ten. As a result, it is advisable that a complex language like Clojure is best tackled by experienced programmers.

Object-Oriented Programming (OOP) Tutorial

Over the last twenty years, Object-Oriented Programming has been widely adopted as the primary methodology for creating new software. The roots of this can be traced back to Smalltalk, a programming language created by Alan Kay in the 1980s, and the groundbreaking works of Ole-Johan Dahl and Kristen Nygaard in 1961.

The widespread use of the Java language in the 1990s, owing to its versatility and platform independence, played a critical role in propelling the growth of Object-Oriented Programming (OOP). Furthermore, during this era, numerous developers started concentrating on Graphical User Interfaces (GUIs), a software development domain that is exceptionally appropriate for an OOP methodology.

Consequently, Object-Oriented Programming (OOP) has become ubiquitous, as it can be applied to virtually any programming language. Python and JavaScript, the two most popular languages in use today, both provide robust support for OOP.

At the core of Object-Oriented Programming (OOP) is the notion of an object, which incorporates both data (referred to as attributes) and code (labelled as methods). As an illustration:

Our team has made a decision to develop a video game with a focus on dogs. We will create a “dog” class, which will incorporate various attributes, including height, fur colour, and dietary preferences. Dogs will partake in actions that are typical to their species, such as walks, meals, nap time, and play sessions, which will serve as the game’s basic mechanics.

There is a possibility of variations in attributes when three dogs are bred together, despite them belonging to the same class. Every dog is unique, even while sharing the same class. For instance, the details related to Fido will not have any impact on Max’s attributes.

Object-Oriented Programming (OOP) is a programming methodology that prioritizes the development of reusable objects and upkeep of software by means of precise world modelling.

A Shift in Paradigm

Thomas Kuhn is famously known for observing that paradigms have limitations. As one’s aptitude in a specific domain expands, it is expected to venture into the outermost boundaries of a given paradigm. As time passes, the inadequacies of this approach will become more apparent.

Critiques of OOP typically fall into two main categories:

  • The outcome is that it only masks disorganized code (spaghetti code) with encapsulation, which is scarcely advantageous in the long run.
  • Efforts to avert unfavourable outcomes are ineffectual. If one isn’t vigilant, objects can easily affect other areas of the code.

In the case of a smaller project, it is uncomplicated to reduce any unexpected outcomes. Nevertheless, with a workforce of twenty developers and a sizeable codebase, this becomes a more intricate undertaking.

As per the Stack Overflow survey, 28% of the participants switched from Java to Clojure, 16% from Python and 15% from JavaScript. Conclusively, these individuals are seasoned developers who have made a decision to transition from an object-oriented programming language to a functional one.

One could make a similar argument for F#. However, despite the possibility of a higher salary, it seems that experienced engineers are opting to transition to functional programming languages. Therefore, what could be the driving force behind this?

Once again, the answer may be present in the aforementioned survey:

  • A third of the respondents employ Clojure due to its functional programming nature.
  • 35% of its users utilise the language mainly because of its “Lispiness,” which they prefer over Java’s verbose nature.

Personal accounts concur with the statistics. Particularly, skilled Java developers are opting to delve into Clojure with the aim of acquiring additional knowledge that can enhance their software development process. In brief, these developers have acknowledged an imperfection in OOP and are searching for alternative alternatives.

How is Clojure applied?

Nubank, the world’s biggest digital bank situated in Brazil, utilizes Clojure as its backend programming language. As per the recent statistics, around 700 Clojure developers are involved in the Nubank project.

Clojure is extensively employed in the banking and corporate software industries, however, its popularity is also on the rise in the healthcare and retail domains.

Companies, regardless of their scale, can reap benefits from the potent solution provided by Clojure. That said, most users of this language are small businesses. Building new solutions from scratch rather than migrating existing ones tends to be the more practical choice, and as a result, Clojure is an ideal option.

Functional Programming over Other Programming Paradigms – Why Opt for It?

Supporters of functional programming contend that it results in a more succinct codebase that is simpler to maintain and debug in contrast to other programming paradigms.

If you are required to change an uppercase “A” into a lowercase “a,” one solution could be to design a function that accepts “A” as an input and yields “a” as an output. This methodology is better than modifying the input data since it avoids any conceivable complications linked to unintended alterations to the data.

Without a doubt, functional programming is receiving increasing support daily. Although some may differ, it is one of the numerous benefits of adopting a functional approach to software development. Does this imply that it will supplant object-oriented programming?

Experienced developers who have embraced the new approach will recruit inexperienced programmers and guide them in its execution. This has the possibility of triggering a domino effect, causing more widespread adoption of the methodology.

While I do not envisage Object-Oriented Programming (OOP) getting ousted from its eminent position soon, I am of the opinion that using a broader range of approaches to address issues would be advantageous in any field. Integrated Programming Services can help in this aspect.

Join the Top 1% of Remote Developers and Designers

Works connects the top 1% of remote developers and designers with the leading brands and startups around the world. We focus on sophisticated, challenging tier-one projects which require highly skilled talent and problem solvers.
seasoned project manager reviewing remote software engineer's progress on software development project, hired from Works blog.join_marketplace.your_wayexperienced remote UI / UX designer working remotely at home while working on UI / UX & product design projects on Works blog.join_marketplace.freelance_jobs