Tuesday, March 11, 2008

Scheme For Enlightenment Part Twenty Four Conclusion

Scheme is definitely worth learning. That said, this comes from someone who thinks that everything is worth learning. Nothing is too trivial. It's worth learning the slide rule and the abacus. More to the point, it seems unlikely that i'll use Scheme for production work. It does not appear that it makes creating applications significantly easier or quicker to write. It's performance relative to C is slow. (However, i've not yet played with Scheme compilers). It does have garbage collection, but that alone will not make Scheme applications bug free, or necessarily easier to debug. I may learn enough of it to write some small image manipulation stuff for the Gimp, however.

Web based applications might work. An application might have several dozen web pages. Many of the pages display a form, and then do something with the answer. The forms can be html files: essentially static text. The form handlers need to be scripts. These scripts gather the form information and do something with it - often update a database. The scripts have very short run times. Even in Perl, the CGI script run time is usually under a second. It's likely that speed doesn't matter, except the Slashdot effect. CGI scripts are often small. A terse language that starts up quickly might be ideal.

With CGI applications, one can use the tool that is ideal for each task. If the database is the glue that holds together an application, and most of the data editing bits are short pages, it might be that some longer running engine needs to be written in another language, which might be C or C++.

Scheme inherited Lisp's flexible run time handling of data, specifically lists. So it is much easier to envision lots of little cooperating scripts creating the emergent property of a coherant web based application. There already exist Scheme libraries for writing CGI based applications, as well as those to interface with databases.

Why is having lots of little scripts better than one huge one? For one, a little script can be easier to write, read and debug. It's easier to write because it's small. CGI provides most of the interfaces. In a script that fits on your screen, it might be evident that this is a handler for mainform.html, stuffs the data into the table app.mainform, then presents optform.html to the user. That and some sort of application overview for how it all fits together might be all you need. No ponderous code. No ponderous documentation.

The only thing left to optimize for a language like Scheme is the barrier to entry. After a year of study, on and off, it's still not easy for me to write more than trivial scripts. It is much easier for me to write 200 lines of C than 20 lines of Scheme. Though much of that is experience, it doesn' look as if it will change soon.

No comments: