I've been seeing so much recently about functional programming and Clojure looks particularly interesting. While I 'understand' the basic description of what it is, I can't figure out how I would use it on a day to day basis as a web developer, if I can at all. A lot of what I have read focuses on the maths side of functional programming rather then typical programming situations found in regular OO.
Have I got the wrong end of the stick? Is functional programming totally un-related to web development? If not, are there any examples of it being used 'for the web'?
Advantages Of Functional ProgrammingIt helps us to solve problems effectively in a simpler way. It improves modularity. It allows us to implement lambda calculus in our program to solve complex problems. Some programming languages support nested functions which improve maintainability of the code.
While there are many different programming languages, the most common ones used in web development are JavaScript, HTML, CSS, PHP, etc. JavaScript has a popularity of nearly 65% among developers worldwide, as per Statista.
Functional programming has been in existence for the last six decades, but so far, it hasn't ceased to overcome the general use of object oriented programming.
Still, "functional programming is unmistakably the future," says Felix. "It can help make a large proportion of the current problems we have in software development disappear.” And it can even be used within established Java ecosystems.
Functional programming matches web apps very well. The web app recieves a HTTP request and produces a HTML result. This could be considered a function from requests to pages.
Compare with desktop apps, where we typically have a long running process, a stateful UI and dataflow in several directions. This is more suited to OO which is concerned about objects with state and message passing.
A few examples off the top of my head:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With