25.01.20185 min
Intetics Inc

Intetics Inc

Functional programming. Does it work in real life?

FP is flexible, contains less language primitives and allows you to make less mistakes.

Functional programming. Does it work in real life?

Developers are, in general, very creative people. But at the same time, they tend to lean towards certain ideas. For example, when speaking about choosing a language, PHP is considered "a language for the lazy" and JavaScript is often referred to as “hard-to-predict magic.” Among this huge variety of languages, functional languages stand out. They are gaining more and more fans, making their way to companies all over the world. What’s the reason for such popularity and why should we consider learning them?

Unnatural but efficient


When it comes to functional programming, a lot of people start with, “But that’s totally unnatural!” Functional programming is compared to working “backwards” and some complain that it’s more about solving puzzles rather than working with code.

Despite such opinions, the support for functional programming is on the rise. Companies looking for FP specialists emphasize they need people with a certain mindset. Let’s try to find out what it all means and pinpoint the kinds of projects that are better fit for the implementation of functional programming.

FP advantages


One of the biggest FP advantages is its ability to perform higher-level abstractions that conceal details of routine operations such as iterations. Due to this feature, the code turns out to be shorter, so it guarantees a smaller number of mistakes you can possibly make.

FP also contains less language primitives. Well-known classes are simply not used in FP. Instead of creating a unique object description with operations in the form of methods, function programming utilizes fewer main language primitives that are highly optimized inside.

In addition, functional programming allows developers to bring the language to the problem and not the opposite, and that’s possible thanks to its flexible structures and language figurability. As well, FP offers developers new instruments (that OOP developers tend to ignore) for solving complex tasks.

Of course, you cannot deny OOP's strengths, but one should also remember that functional languages, if we judge by their ease of use, stand alongside other languages.

So why is it getting popular?


In the world of IT, nothing happens without a reason. One thing leads to another, and in the end, the biggest trends get connected together.

Remembering the hottest trends from 2016-2017, I would obviously say AI, IoT, Big Data and Blockchain. Everyone is familiar with them and everyone knows their potential and key features. Some of these trends even served as catalyzers for the rise of functional programming among developers.

Right now there is a pressing issue with parallel processing and work related to large data streams, or in other words, Big Data. By paralleling the data processing, you can achieve results within a fraction of a second, which is critical in real world situations. Don’t forget about decentralized (distributed) computing as well – blockchains and others that are actually quite complex mechanisms.

Functional code fits such computation perfectly due to all principles of functional programming (like pure functions, for example). By using all basic principles, FP makes parallel execution of code and its support easier.

In the last years functional programming was used only for solving some specific tasks, but now people use it even for classic projects. We can say for sure that major IT companies should not hesitate to use functional programming. Let me use one of Intetics' projects as an example, where developers work on rich front-end applications with an interactive UI.

About the project


Before the Intetics team joined the project, the client had already developed his own functional language. We’ll talk later about the reasons for that, but now we’ll answer the pressing question: Why exactly is functional programming used in this project?

The project is about developing a system of adaptive education for a broad audience, from educational establishments to various non-academic courses like wine making. Another part of the project is corporate education, which means developing an educational course for the specific needs of a company or an organization.

Our client was not only an innovator (at that time his solution was unique on the market), but also a very sharp-sighted individual. He saw all the FP advantages before his competitors did, so he could ensure high product quality and support. Functional programming guaranteed that the code was concise and went well with the client’s preferences. It’s worth noting that OOP could also fit this project and the client tried several languages, but chose functional programming after all.

Let's go back to the reasons for developing his own language - and we're talking about a project with 10 years of history here. 10 years ago, the client couldn't find an advanced cross-platform framework to satisfy his needs, so he decided to create his own.

It was a flow enabling quick UI creation for various platforms. It made the process much easier because he could quickly implement changes and solve tasks related to the project. In addition, there still aren't many cross-platform functional languages, so the project really stands out.

Conclusion: don't be afraid to try


You have probably got by now that functional programming is nothing to be afraid of. A bit of effort and curiosity will put you on the right path toward learning all about FP. Considering its growing popularity, you will have plenty of opportunities to implement your new skills.

<p>Loading...</p>