[wplug] web programming

Matthew Danish mdanish at andrew.cmu.edu
Tue Oct 28 12:06:38 EST 2003


On Tue, Oct 28, 2003 at 01:00:15AM -0500, Joe wrote:
> I dont really consider this off-topic since this all relates to things 
> you can do with linux and apache..
> 
> There was a book review on slashdot earlier about EJB's and reading the 
> comments and other comments from the linked webpages I saw a lot of 
> people bash java for one reason or another. Granted, I've never done 
> anything with EJB's or J2EE, most people could very well be right on 
> saying its a horrible way to structure something. But at the same time, 
> theres a lot of people complaining about java, php, perl, and those ms 
> languages in general.
> 
> So if anyone here does or has done a great deal of web programming, I'd 
> really like to know your opinion on what you use and why. 

I've used PHP in the past.  One of the advantages, as you probably know,
is that it is easy to get going with.  But it is not a very expressive
language, considering, and it tends to get very messy rather quickly.

Over the past few years I've been using Common Lisp.  I started out with
an Apache module called mod_webapp which talked to CMUCL over a socket.
Now I just use a web server written in CL called Portable AllegroServe,
since I don't need any Apache-specific functionality at the moment.

The advantage of Common Lisp, I feel, is that you get a superbly
interactive environment, a powerful high level language, and mature
compilers.  For example, while I am writing some code for the
application, my co-worker might be working on a template file, someone
else might be testing it, and my boss can check the progress, all of
this happening on the same constantly-running process.  The development
cycle is tighter than even your typical scripting language, since I
compile-and-load new definitions directly into a running application
with a keystroke.  If something breaks, then there is a condition system
which lets you handle it in numerous ways, including continuing from the
point of the error with fixed code or new values.

(publish 
  :path "/hello-world"
  :content-type "text/html"
  :function (lambda (req ent)  ;; current request and entity
	      (with-http-response (req ent)
	        (with-http-body (req ent)
		  (html (:html (:body (:p "Hello World"))))))))

This would most likely get abstracted in a real application, for example
in one of mine that uses a template system:

(defaction do-something ((req ent cont) query-var1 query-var2)
  ;; query-var1 and 2 are given values from the query string
  (do-something query-var1 query-var2)
  (display-page cont req ent))

The high-level abstraction capabilities of Lisp make it really easy to
get lots of things done without worrying about little book-keeping
details constantly, which I find to be an extremely useful feature when
writing web-applications.

One disadvantage is that the community for CL is not as large as it is
for Perl or PHP, though it is quite active these days, so there isn't
any huge accumulation of libraries like CPAN.  Most CLs (there are many,
all purporting to follow the ANSI standard) offer some way of
interfacing with C libraries.  There are also efforts to gather Lisp
libraries into a repository, and to provide central resources for
information.  http://www.cliki.net/ is one such site.

-- 
; Matthew Danish <mdanish at andrew.cmu.edu>
; OpenPGP public key: C24B6010 on keyring.debian.org
; Signed or encrypted mail welcome.
; "There is no dark side of the moon really; matter of fact, it's all dark."



More information about the wplug mailing list