From: Alex Mizrahi
Subject: ABCL for web-programming, reloaded
Date: 
Message-ID: <42a24fdd$0$18637$14726298@news.sunsite.dk>
hello

i was using Armed Bear Common Lisp -- an implementation of Common Lisp in
Java for Java VM -- for web application programming, with Lisp implementing
a servlet in Java servlet container. application being developed is some
fairly simple learning management system that i was doing as a work for
master's degree for my university.
i would like to share my experience and impressions from this -- possibly it
can be helpful to others. in general, i find results of development quite
successful, although there were some difficulties.

first, why should anyone care about ABCL for web-proramming. there are
different approaches to web application development with Common Lisp, but
they can run into multiple problems, for example, deployment -- deployment
of Common Lisp application can require special software to be installed on
server and special software configuration.
using ABCL can bring such benefits:

* easy deployment. from Java point of view, Lisp web application is just a
simple web application, same as any Java one, and ABCL itself is just some
kind of library. so, to deploy application it's only required to copy it
there and press a button in a  server manager. there is no need for special
software on server, any hosting supporting Java should do. and (in theory,
at least) it should run same on any OS -- Windows, Linux, FreeBSD, Solaris
or MacOS.

* servlet approach. it runs as servlet, so it can be initialized once and
keeps it state in memory. this typically is much better than CGI-style stuff
because there is no need to serialize   everything somewhere each time -- 
lisp structures that shouldn't be persistent can be keeped in  memory. and
it should be faster than CGI, for some application it can be very
significant. also, it allows to use such approach as continuations, that
dramatically improves development process.

* interactive environment. it is possible to use development environment
like SLIME to develop
  ABCL servlets, so functions can be implemented in tested in top-level, it
can be debugged -- it
  catches exception in debugger.

* stability. certainly, ABCL is in alpha state (current version is 0.0.5),
so it cannot be highly reliable. however, it has some benefits comparing to
other approaches -- it runs over a stable and tested Java servlet container,
which handles most things about HTTP protocol. each request is processed in
separate thread. (as far as i know,  it is issue with CMUCL for example,
since there is no kernel-level thread support there, and singal-based hack
is not stable at all. in other free lisps thread support is not perfect too,
as far as i know). also, because it's based on Java, it will barely ever
show stuff like SEGFAULT or other low-level errors.

* Java libraries. there are a lot of Java libraries (standard API itself is
vast),
  and most of them can be easily used via jfli-abcl. for example, libraries
for
  SQL-server connection can be easily imported, so it can contact to any SQL
server
  supporting JDBC or ODBC.

but there can be also some drawbacks in using ABCL:

* speed and size. ABCL is not very fast (but it should be enough for web
stuff). it also eats quite a lot of memory (Apache Jakarta Tomcat with my
lisp web application running eats about 50-60 mb of RAM), it generates lots
of files during compilation of files, and loading is quite slow. servlet
initialization also takes some time (my servlet is loaded about a minute)

* there might be some language compatibility issues, buggy CLOS support, for
example.

so, about my web application..
first i started doing it in usual approach -- parsing requests, sending
variables as form
parameters, managing sessions. but soon i found that i'm unable to code in
clean way,
code in general was much better than it could be in PHP, but it was quite
messy.

then i tried continuation-based approach. code for CPS-transform was taken
from UCW,
particulary from arnesi library by Marco Baringer. luckily, it worked in
ABCL quite fine.
i've implemented some framework that allows to separate application logic
from
web-page generation and allows to easily connect input from web forms to
application flow.
for my relatively incomplex interface, that worked quite fine.

development with continuations impressed be a lot. i could implement things
which were looking like a cryptic state machines with usual direct code.
this is something like moving from low-level programming language (like
assembler) to a much higher-level one.

for xhtml generation i used LML2, that is based on htmlgen by Franz Inc.
i use MySQL as RDBMS, i've got JDBC code wrapped in some more high-level
functions,
so there is no SQL in application logic, however it only somewhat resemles
object-relational
mapping, and is very imperfect. as i remember UncommonSQL was much better,
but porting
it to work with JDBC could take some time..
i also found that cl-ppcre regex library is working quite well in ABCL, in
spite that this support is not mentioned in cl-ppcre docs..

if there is somebody interested in this stuff, i can make package with demo
application code and publish it somewhere.

with best regards, Alex 'killer_storm' Mizrahi.

From: Marco Baringer
Subject: Re: ABCL for web-programming, reloaded
Date: 
Message-ID: <m2y89pjis3.fsf@soma.local>
"Alex Mizrahi" <········@users.sourceforge.net> writes:

> then i tried continuation-based approach. code for CPS-transform was
> taken from UCW, particulary from arnesi library by Marco
> Baringer. luckily, it worked in ABCL quite fine.  i've implemented
> some framework that allows to separate application logic from
> web-page generation and allows to easily connect input from web
> forms to application flow.  for my relatively incomplex interface,
> that worked quite fine.

i'm really glod to hear that. was there something you didn't like
about the rest (the component stuff basically) of ucw? is there
anything ucw could steal from your code?

> for xhtml generation i used LML2, that is based on htmlgen by Franz
> Inc.  i use MySQL as RDBMS, i've got JDBC code wrapped in some more
> high-level functions, so there is no SQL in application logic,
> however it only somewhat resemles object-relational mapping, and is
> very imperfect. as i remember UncommonSQL was much better, but
> porting it to work with JDBC could take some time..  i also found
> that cl-ppcre regex library is working quite well in ABCL, in spite
> that this support is not mentioned in cl-ppcre docs..
>
> if there is somebody interested in this stuff, i can make package with demo
> application code and publish it somewhere.

i would love to see what you came up with for dealing with forms (i've
built n-million web form apis, not a single one has convinced me).

-- 
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
	-Leonard Cohen
From: Andras Simon
Subject: Re: ABCL for web-programming, reloaded
Date: 
Message-ID: <klhdgdb1yh.fsf@hexagon.renyi.hu>
"Alex Mizrahi" <········@users.sourceforge.net> writes:

 
> if there is somebody interested in this stuff, i can make package with demo
> application code and publish it somewhere.

Please do. At the very least, it'd be a much more useful jfli-abcl example
than the present ones. I'd love to make a link to it from jfli-abcl's README.

Andras