Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To which kind of problem is functional programming well suited? [closed]

Functional programming seems to be a paradigm in computer science which has more and more echo.

I wonder which kind of problems are better solved with a functional programming approach rather than with a more traditional object oriented approach.

Thank you.

like image 996
sthiers Avatar asked Oct 14 '08 09:10

sthiers


People also ask

What is functional programming best used for?

Functional Programming is used in situations where we have to perform lots of different operations on the same set of data. Lisp is used for artificial intelligence applications like Machine learning, language processing, Modeling of speech and vision, etc.

What are the two categories of functional programming?

Functional languages include two categories: pure and impure. Pure functional programming only supports functional paradigms, whereas impure functional programming supports functional paradigms, among others. Some examples of common programming languages that emphasise functions include: Haskell.

What type of programming is defined by the term functional programming?

Introduction. Functional programming is a programming paradigm in which we try to bind everything in pure mathematical functions style. It is a declarative type of programming style. Its main focus is on “what to solve” in contrast to an imperative style where the main focus is “how to solve”.


1 Answers

Functional programming is best suited for most kinds of problems, including anything you would normally use object-oriented programming for, except for maybe problems that require the storing of a lot of state or other side effects. Aside from that, FP handles complex problems much more gracefully than OOP, as a lot of it comes from a mathematical background (starting with the lambda calculus). You have much more flexibility as far as abstraction and composition go. An object-oriented program with a lot of design patterns could be refactored using more functional constructs which will allow you to do the same thing without the boilerplate structures that design patterns make you write. In addition to mathematics and parsing, FP has also been extensively used in artificial intelligence (particularly Lisp).

like image 148
Mark Cidade Avatar answered Nov 16 '22 23:11

Mark Cidade