[erlang-questions] Similarities between web programming and functional programming

黃耀賢 (Yau-Hsien Huang) <>
Mon Jun 14 17:27:38 CEST 2010


On Sun, Jun 13, 2010 at 4:19 AM, Nilanjan Raychaudhuri <
> wrote:

> Hi all,
>
> As a newbie into functional programming I am curious to know how functional
> programming style fits into building web applications? And how it
> compares to building web apps in Ruby or Java.
>
> Any pointer to article/literature will be helpful.
>
> Thanks
> Nilanjan


In general, subjects in Functional Programming may be:
* Value is function, and anything is value.
* Immutable value.
* Lazy evaluation strategy, and what about that when some but not all
arguments are
  given to a function you get another function. (I forgot terms about the
later one.)
* Higher order function.
* Pure function, or imperative, with side-effect.

How does it fit Web Programming? In my opinion,
1. Anything is value, yes, some techniques and paradigm of Web Programming
such
   as that about XML technologies follow this style. XSLT can be written
FUNctionally.
   Parts of web technology are not Software Engineering any more but Data
   Engineering.
2. Immutable value means that program runs without depending on state.
Microsoft
   .Net Framework tried making the stateless Web environment stateful. In
functional
   programming, when you send a different request, the program generates
another
   set of values instead of making a response with a modified state.
3. Partial application of function arguments is powerful than other
programming styles.
   Consider a web form as a function that it accepted some of it arguments
and
   `became' another function, that is, another web form or the original form
holding
   some arguments and waiting for other arguments.
4. High order function plays role of glue. Web Programming is performed in
parallel;
   you and your colleagues write each's programs, and you put those
together,
   and those works as a whole. High-order function do somethings similarly:
   Functions may be glued by some function, and those work as a whole while
   each can be run separately for the debugging purpose.

You post the question in Erlang mailing-list. About Erlang, its
Concurreny-Oriented
Programming style is more feasible for Web Programming and more discussible
than functional programming features.

Best Regards,
Y.-H. H.


More information about the erlang-questions mailing list