Lisp in Web-Based Applications
(This is an excerpt of a talk given at BBN Labs in Cambridge, MA, in April 2001.)
Any Language You Want
One of the reasons to use Lisp in writing Web-based applications is that you *can* use Lisp. When you’re writing software that is only going to run on your own servers, you can use whatever language you want.
For a long time programmers didn’t have a lot of choice about what language to use for writing application programs. Until recently, writing application programs meant writing software to run on desktop computers. In desktop software there was a strong bias toward writing the application in the same language as the operating system. Ten years ago, for all practical purposes, applications were written in C.
With Web-based applications, that changes. You control the servers, and you can write your software in any language you want. You can take it for granted now that you have the source
code of both your operating system and your compilers. If there does turn out to be any kind of problem between the language and the OS, you can fix it yourself.
This new freedom is a double-edged sword, however. Having more choices means that you now have to think about which choice to make. It was easier in the old days. If you were in charge of a software project, and some troublesome person suggested writing the software in a different language from whatever you usually used, you could just tell them that it would be impractical, and that would be the end of it.
Now, with server-based applications, everything is changed. You’re now subject to market forces in what language you choose. If you try to pretend that nothing has changed, and just use C and C++, like most of our competitors did, you are setting yourself up for a fall. A little startup using a more powerful language will eat your lunch.
There is a certain style of software development associated with
Lisp. One of its traditions is incremental development: you start by writing, as quickly as possible, a program that does almost nothing. Then you gradually add features to it, but at every step you have working code.
I think this way you get better software, written faster. Everything about Lisp is tuned to this style of programming, because Lisp programmers have worked this way for at least thirty years.
The Viaweb editor must be one of the most extreme cases of incremental development. It began with a 120-line program for generating Web sites that I had used in an example in a book that I finished just before we started Viaweb. The Viaweb editor, which eventually grew to be about 25,000 lines of code, grew incrementally from this program. I never once sat down and rewrote the whole thing. I don’t think I was ever more than a day or two without running code.
The whole development process was one long series of gradual changes.
This style of development fits well with the rolling releases that
Are possible with Web-based software. It’s also a faster way to
Get software written generally.
Lisp’s interactive toplevel is a great help in developing software
Rapidly. But the biggest advantage for us was probably in finding bugs. As I mentioned before, with Web-based applications you have the users’ data on your servers and can usually reproduce bugs.
When one of the customer support people came to me with a report of a bug in the editor, I would load the code into the Lisp
Interpreter and log into the user’s account.