Hi,
1) Are functional languages suited for web applications development ?
2) Are functional languages suited for business/erp/crm type of applications ?
Hi,
1) Are functional languages suited for web applications development ?
2) Are functional languages suited for business/erp/crm type of applications ?
Functional languages are well suited for webapp development, scala in particular.
Have a look at the Lift framework for more info.
Functional Languages are good for anything you would like to use them for.
However, developing applications these days are not as simple as using a programming language. The advantage of Java and C# etc is that they come with large libraries of code and other environment niceties that are absolutely required when you build business software. Most functional languages does not have that great support (as yet?).
F# might be promising since its in the .NET environment and can take advantage of the tools available there (correct me if I'm wrong).
This article describes how Lisp - an early functional language - was used to create a web based application successfully.
While I wouldn't say that any particular functional languages are tailored for doing web-development, I also wouldn't say that you can't do web development with a functional language. I think that depends entirely on what web frameworks may be available for the language you choose and whether or not there are any web servers that will support the language.
For instance, I'm sure that you can use F# along with ASP.Net on IIS to do web development. I doubt there's support for F# in the templating engine, but you can definitely write business logic in F#.
Similarly, there's mod_haskell
for Apache, which should make it relatively easy to have dynamic output with haskell. Although, I've never personally used it. At the same time, if there's a mod_(erlang or scala)
for Apache, it would be similarly easy for those languages.
Ultimately, I think that the stateless nature of functional languages should make it well suited for a stateless, MVC style web framework. However, I think it really comes down to what tools and frameworks are available to make your life easier when working with these languages. For example, Ruby wasn't really popular for web development until rails got popular, and I didn't really like doing anything webby with Python until I found django.
Functional languages of the kind you describe are general purpose programming languages, they're used for all manner of things, including web apps and business apps. (I use Haskell).
As gabor implies, ultimately it comes down to libraries. Scala has a web framework: lift. Haskell has happstack, as well as 2100 (in 2010) libraries on Hackage for all manner of thiings.
It really isn't so much a question of the language, as the toolchain, when considering particular specialized domains.
One of the biggest advantages claimed by proponents of functional languages is that they make it easier to write programs that can execute in parallel. But web applications typically don't have problems with parallelism. Typically, the web server/application server maintains a pool of threads, and each user request is assigned to a different thread, which can run on a different physical processor. So, you can take advantage of multiple processors without too much trouble. The trick is that web apps are characterized by large numbers of small requests, and threads and imperative languages work well there. Where imperative languages start to break down is when you have a small number of computationally expensive requests.
Another big advantage of functional languages is that since functions have no side effects, testing is easier. You test each function in isolation across a few of its inputs, and you know the system will work. But, there's a catch. If your operation involves input or output, you use a monad rather than a function, and you lose this testability benefit for that portion of your code.
But, typically web applications involve reading information from a request, making requests to a database, reading the response from the database, and formatting a response. That's lots and lots of IO, or monads, and very little opportunity for functions.
Given these characteristics of web applications, what benefits do functional languages bring to web application programming?
Functional languages provides new kinds of abstractions which can be used for web development. Continuation based web servers are for example popular among functional languages. The PLT Scheme web server supports this kind of web application development. You can read more about continuations and their use in web development on wikipedia
Most functional languages, namely the ones you included, are considered general purpose languages. For web development, I would deeply consider using Clojure, or Scala. They both have very good web frameworks, and they both run on the JVM. I can totally recommend Clojure and Scala, but not so much for the others.
Haskell has a web framework, but I have never used it.
Business applications? Sure, why not. Functional languages are great for just about anything.