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

I find data deeply captivating. I am constantly in awe of the potential of data science and the insights that can be gained through statistics. Examining the StackOverflow developer poll each year to uncover any anomalies and gain new perspectives is a hobby of mine. As of 2023, Clojure would be considered a perfect illustration of this.

Rich Hickey, author of Clojure, has described the functional programming language as being “similar to Lisp for the Java Virtual Machine”. He has highlighted its speed and versatility, noting that it gives developers the tools to create robust code.

Let’s have a look at the data:

  • With just 2.25 percent of respondents using Clojure, the results of the StackOverflow study aren’t exactly surprising.
  • Clojure is the second most beloved language, behind only Rust, with 81% approval among its users.
  • The average annual salary for a Clojure developer is approximately £70,000, with F# (another functional programming language) coming in second at around £64,000.

Upon first glance, I was immediately intrigued by Clojure. It appears that the demand is high but the supply is limited, leading to higher costs due to the lack of developers.

The results of the State of Clojure 2023 poll demonstrate that 65% of respondents with development experience have been in the field for at least six years. This is a significant proportion, considering that half of the population is over 10 years of age. It is therefore recommended that such a complex language such as Clojure is best left to experienced programmers.

Tutorial on OOP (Object-Oriented Programming)

Over the past two decades, Object-Oriented Programming has become the standard approach for developing new software. This can be attributed to the inception of Smalltalk, a computer language developed by Alan Kay in the 1980s, and the pioneering works of Ole-Johan Dahl and Kristen Nygaard in 1961.

The success of Java as a versatile, multi-platform programming language in the 1990s helped to drive the growth of Object-Oriented Programming (OOP). Additionally, it was during this decade that many developers began to focus on Graphical User Interfaces (GUIs), a software development area that is particularly suited to an OOP approach.

As a consequence, Object-Oriented Programming (OOP) has become the standard, as it can be utilized in almost any programming language. Both Python and JavaScript, which are the two most widely used languages today, offer extensive support for OOP.

Object-oriented programming (OOP) is centered around the concept of an object, which encompasses both data (known as attributes) and code (known as methods). To provide a brief example:

We have made the decision to develop a video game with a canine theme. We will create a “dog” class, featuring characteristics such as height, coat color and diet preferences. Dogs, like humans, go for walks, eat, sleep and play with toys, such as balls. All of these activities are part of the game mechanics.

It is possible that the attributes of three dogs bred together may vary. Although they all share the same class, each dog is an individual. For example, the information pertaining to Fido will not have any effect on Max’s.

Object-oriented programming (OOP) is a programming paradigm that focuses on the creation of reusable objects and the development of maintainable software through the use of accurate world modelling.

Paradigm Shift

Thomas Kuhn famously noted that paradigms have their limitations. With increasing expertise in a certain area, it is natural to start exploring the edges of a given paradigm. Over time, the shortcomings of this approach will become more evident.

OOP is usually attacked with two main types of criticism:

  • In the end, all it accomplishes is cover up messy code (spaghetti code) with encapsulation, which is hardly a benefit.
  • Attempting to prevent adverse consequences is futile. Objects may easily affect other parts of the code if you aren’t cautious.

When working on a limited project, it is straightforward to minimize any unforeseen outcomes. However, with twenty developers and a large codebase, this is a more complex task.

According to the Stack Overflow poll, 28% of respondents transitioned from Java to Clojure, 16% from Python and 15% from JavaScript. This indicates that these individuals are experienced developers who have decided to move to a functional programming language from an object-oriented one.

It could be argued that the same could be said about F#. However, it appears that senior engineers, regardless of the potential for higher pay, are making the switch to functional languages. So, what could be the motivation behind this?

Again, the solution may be found in the poll:

  • One third of the sample uses Clojure since it is a functional programming language.
  • A third of its users (35%) do so because they prefer the language’s “Lispiness” over Java’s general verbosity.

Anecdotal evidence is in agreement with the figures. Particularly experienced Java developers are choosing to explore Clojure, desiring to gain new knowledge which could refine their development process. To summarize, these programmers have identified a defect in OOP and are searching for alternative options.

How is Clojure put to use?

Nubank, the largest digital bank in the world based in Brazil, utilizes Clojure as its backend language. According to the latest data, approximately 700 Clojure developers are involved in the Nubank project.

Clojure is widely used in the banking and corporate software sectors, but it is also gaining popularity in the healthcare and retail sectors.

Organizations of all sizes can gain advantages from the powerful solution offered by the language. However, the majority of users are small businesses. It is more sensible to create new solutions from the ground up, rather than migrate existing ones, which makes this an ideal choice.

When Compared to Other Programming Paradigms, Why Choose Functional?

Proponents of functional programming assert that it leads to a more concise code base that is easier to maintain and debug, compared to other programming paradigms.

If you need to convert an uppercase “A” to a lowercase “a”, one way to achieve this is by creating a function that takes “A” as an input and returns “a” as the output. This approach is preferable to altering the input data as it avoids any potential issues associated with accidental transformation of the data.

It is undeniable that functional programming is gaining more and more support on a daily basis. Though some may disagree, it is one of the many benefits of utilizing a functional approach to software development. Is this intended to replace object-oriented programming?

Senior developers who have adopted the new method will be recruiting novice programmers and providing them with guidance on its implementation. This has the potential to result in a cascade effect, leading to a wider use of the method.

I do not anticipate Object-Oriented Programming (OOP) losing its place of prominence any time soon, however I believe that any field would benefit from the use of a wider range of techniques to solve problems. Programming Services Integrated can offer assistance in this area.

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