logo

What Is The Problem With Functional Programming?

Michael Morales  -  January 10, 2022  -  ,  

Functional programming is a programming paradigm in computer science in which programs are built by applying and composing functions. It's a declarative programming technique in which function declarations are trees of equations that map values to other values instead of a series of imperative statements that update the program. 

Functional programming can be beneficial because it can make solutions shorter and clearer in many circumstances (especially for some types of issues like logic programming and compiler writing), partially because it makes backtracking trivial. However, there are drawbacks and issues with functional programming. Some of them are discussed below.

Input/Output

Since I/O is based on side effects, it is fundamentally non-functional. However, it turns out that it is also necessary for building a good application. There are several ways to incorporate IO into your application.

The best approach to IO in functional code is isolating it and accepting that it will never be functional. If you isolate it effectively, you may compose it using functional code and consider the IO results as a value. 

Computer’s non-functionality

The computer’s non-functionality doesn’t mean that computers don't work. It just means that they don't work properly. They rely on stateful, imperative operations to function. Computers are big state machines when it comes to functioning, so the idea of a purely functional language down to hardware doesn't make sense.

Recursion

While recursion is sometimes recognized as one of the best features of functional programming, it is also somewhat expensive to utilize. It frequently uses the call stack as a data structure, yet memory is a scarce resource. 

There are techniques to write recursive functions that are less memory intensive, but they either involve compiler optimizations or a modest rewrite of the recursive function.

For years, the functional programming community has been flaunting stunningly small implementations of the Eratosthenes Sieve and Quicksort algorithms. For years, these were even taught to pupils. But every coin has two sides.

Visit our blog page to learn more about various programming styles and uses.

OUR BLOG
Strangler Fig Pattern
Strangler Fig Pattern
Any codebase that is old enough will ultimately contain legacy code. The moment architecture, performance, and comments are written, they ...
What is Web3?
What is Web3?
You are a participant in the modern web if you are reading this. The internet we use is very different ...
What Does 'this' Mean in JavaScript?
What Does 'this' Mean in JavaScript?
Let's look at a very comparable notion in the English language called polysemy to see what this really implies in ...
1 2 3 29
logo
J-sim's goal is to be one of the broadest online sources of content for Computer Technology, Internet Security, and anything within the World Wide Web. We aim to provide the information and tools needed to help enhance our readers' minds when it comes to today's technological advancements.
Copyright © 2022 j-sim. All Rights Reserved.
DMCA.com Protection Status