Is functional programming relevant to web development?
stackoverflow.com
Is functional programming relevant to web development?
1–10 of 27 posts
Re: Is functional programming relevant to web development?
#2Re: Is functional programming relevant to web development?
#3At least that's my reason.
Re: Is functional programming relevant to web development?
#4Possible exceptions would include Seaside, which I've never used but has been around for a while and from what I can see has a genuinely different approach to web development that actually does exploit Scheme, and Erlyweb (and to some extent the Erlang frameworks in general), which naturally exploit being on the Erlang VM which has interesting consequences for certain types of web apps. I suspect neither would look particularly mature next to Ruby on Rails, but if you happen to have a need that matches those they may still be a win.
Re: Is functional programming relevant to web development?
#5The reason why functional programming is popular with web programming is that it explicits shared and changing state and allows the programmer to express the purely functional parts as pure functions. Pure functions have the advantage of being very simple to run in parallel - as they have no side-effects. At least that's my reason.
Re: Is functional programming relevant to web development?
#6>Yahoo! Store was written by Paul Graham, who is a big Lisp advocate. He also wrote Hacker News, which is, effectively, a Reddit clone.
Re: Is functional programming relevant to web development?
#7There are various interesting things in the various functional worlds in the very early phases of being interesting, but unless you are the sort of web programmer who routinely just programs up their own frameworks I couldn't really recommend any of them right now if you're not already a pretty good functional programmer and you're actively interested in participating in such early experiments. Possible exceptions wo…
Unless we are talking 'bout a different framework, Seaside is Smalltalk.
Re: Is functional programming relevant to web development?
#8FP fits nicely because in FP you're always "threading the state" -- keeping everything you need around to make the program work. Functions can sit on a server, or on a million servers, and seamlessly process messages from clients. This is easily being done in the OOP-world, but on the FP side it's trivial, whereas with OOP there can be a lot of hoops to jump through.
WebSharper is very cool -- takes F# and makes it run as javascript. So you write one script module, annotating methods as running either on the client, server, or both, and then you just code as if all the methods were in the same spot. It figures out how to write the javascript and how the methods can talk to each other.
I'm also seeing some cool stuff with functional-reactive programming, which, if taken to its logical extreme, could rewrite large parts of the web server stack. In my opinion, because of the architectural nature of the web, in a lot of ways, functional code maps much more closely with web operations than OOP does.
Having said all of that, programming is programming, and if you know what you're doing, you can make things happen. Choice of languages and brands can be vastly overrated. The important part is knowing how to use the tools.
Re: Is functional programming relevant to web development?
#9Just make sure you don't pointlessly store continuations when you don't need to, like on Hacker News.
People often use Darcs as an example of why functional programming is a bad idea "for industry". But the irony is that Darcs has a state-heavy mutable data storage model. This is what makes it slow, not Haskell.
Compare Darcs to Git's completely immutable model, and you'll notice that you get fast Git clients even if you implement it in a language like Ruby.
The "takeaway" from functional programming is that immutability scales, no matter what syntax you implement the pure data structures in.
Since starting with Haskell many years ago, I don't think I've written any application that's been dependent on a mutable datastore. With nearly every business application requiring auditing and historical data retention, doing things right even gets you bullet-point features for free!