Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Web Development with OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Gerd Stolpmann <info@g...>
Subject: RE: [Caml-list] Web Development with OCaml
On Wed, 11 Jul 2001, Francois Rouaix wrote:
>Also, I had doubts about the usefulness of a mod_ocaml. In practice (meaning
>in the real .com world, where I was working at the time), one uses multiple
>tier architectures. And you want something in the frontend that is simple
>that non-real programmers can still tweak; something that only does layout,
>no logic.

A good comment. I am currently doing web development, and from my experience the
separation of layout and logic is very useful for real-world projects. Not only
because non-programmers can contribute, but also because of general
maintainability (customers often want only layout changes).

200 requests per second for a web application? Well, I must admit that my web
apps are much slower, maybe you can get 5 rps on a single CPU. But my
applications are very complex, and a clean design was more important than
speed. So I think a high-speed web platform isn't what I need.

My apps are always mixtures of languages and principles. Most of them use Perl
scripts to describe the front-logic, O'Caml as powerful background engine, and
XML to describe the layout. Many applications are simply CGIs. If speed did not
suffice, I switched to a simple application server architecture: A CGI program
is the connection between the web server and the application server, and the
latter simply forks for every new request. This works fine, is rock-stable, and
is fast enough (~0.5 seconds request/response time).

I already mentioned earlier this year on this list that I have written an
XML-based template system that makes it easy to separate layout and logic.
Sorry, I have not found the time to release it. I hope I can do it in the next
weeks (my boss is in holidays).

I have further plans with PXP, my XML parser. The idea is to have a camlp4
syntax extension for embedded XML. You can simply write something like

let table_row (a,b) =
  <:xml< <tr><td>This is $a</td><td>And this is $b</td></tr> >>

let table rows =
  <:xml< <table><?list rows?></table> >>

let my_tab =
  table ( table_row ["the first row","another cell"; 
                             "the second row", "nonsense"])

(I am not sure about the syntax.)

A converter from XML to HTML is very simple to write, such that a web app could
dynamically create the XML tree in memory, optionally validate it, and write it
as HTML code. I think that would already simplify web development a lot.

For a complex web application, one needs more library modules. For example a
module that manages the "micro-state" of the application (i.e. the state that
is not stored by the database but simply passed through all requests).
Furthermore modules that help to create and manage HTML widgets.

Gerd Stolpmann      Telefon: +49 6151 997705 (privat)
Viktoriastr. 45             
64293 Darmstadt     EMail:
Bug reports:  FAQ:
To unsubscribe, mail  Archives: