<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:media="http://search.yahoo.com/mrss"
	>

<channel>
	<title>Dan Weinreb's Weblog</title>
	<atom:link href="http://dlweinreb.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dlweinreb.wordpress.com</link>
	<description>Software and Innovation</description>
	<pubDate>Wed, 30 Apr 2008 12:49:06 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
			<item>
		<title>This Is Your Brain On Music</title>
		<link>http://dlweinreb.wordpress.com/2008/04/30/this-is-your-brain-on-music/</link>
		<comments>http://dlweinreb.wordpress.com/2008/04/30/this-is-your-brain-on-music/#comments</comments>
		<pubDate>Wed, 30 Apr 2008 12:49:06 +0000</pubDate>
		<dc:creator>dlweinreb</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dlweinreb.wordpress.com/?p=31</guid>
		<description><![CDATA[This Is Your Brain On Music, by Daniel J. Levitin, is the most exciting science book that I&#8217;ve read in a long time.  It&#8217;s all about music: what is music, how do we perceive music, why do we care about music, and, primarily, what do we know about how the mind and brain react, [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><em>This Is Your Brain On Music</em>, by Daniel J. Levitin, is the most exciting science book that I&#8217;ve read in a long time.  It&#8217;s all about music: what is music, how do we perceive music, why do we care about music, and, primarily, what do we know about how the mind and brain react, process, and create music.</p>
<p>Some facts that I learned:</p>
<p>If I put electrodes in your visual cortext, and then I showed you a red tomato, there is no group of neurons and will cause my electrodes to turn red.  But if I put electrodes in your auditory cortext and play a pure tone in your ears at 440 Hz, there are neurons in your auditory cortex that will fire at exactly that frequency, causing the electrode to emit electrical activity at 440 Hz &#8212; for pitch, what goes into the ear comes out of the brain!  I find this amazing.</p>
<p>If you&#8217;re familiar with the phenomenon of restoration of the missing fundamental, in which you perceive the fundamental pitch if you are played only overtones of the pitch: it turns out that you can put in an electrode, play music with the fundamentals missing, and the electrode actually shows energy at the fundamental frequency!  The very fact that we can know things like this is exciting.</p>
<p>Ordinary people, when asked to sing a song (of which there is one well-known canonical recording, such as most pop songs), will sing back the song at almost the exactly correct tempo!  (They are accurate within 4%, which is as good as most people can perceive anyway.)  They also often get the key right, even though few people have &#8220;perfect pitch&#8221; per se.  I would never have guessed this.</p>
<p>The brain stem and the dorsal cochlear nucleus &#8212; structures so primitive that all vertebrates have them &#8212; can distinguish between [musical] consonance and dissonance; this distinction happens before the higher level, human brain region &#8212; the cortex &#8212; gets involved.</p>
<p>The book is extremely readable and fun.  It teaches you all the music theory you need to know.  In fact, his basic music theory section is the best quick introduction to music theory I&#8217;ve ever read.  The author has been a professional producer, so he knows a lot about how modern music recordings are made.  He currently runs the Laboratory for Musical Perception, Cognition, and Expertise at McGill Unversity, and has published a lot in serious scientific journals.  That&#8217;s a combination of expertise that may be unique.  He knows several well-known musicians and quotes from them; what Stevie Wonder and Joni Mitchell have to say is quite interesting.  The book is available in trade paperback for only $15 US.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dlweinreb.wordpress.com/31/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dlweinreb.wordpress.com/31/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dlweinreb.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dlweinreb.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dlweinreb.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dlweinreb.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dlweinreb.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dlweinreb.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dlweinreb.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dlweinreb.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dlweinreb.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dlweinreb.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dlweinreb.wordpress.com&blog=2003081&post=31&subd=dlweinreb&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dlweinreb.wordpress.com/2008/04/30/this-is-your-brain-on-music/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Nerdcore Rising - A Documentary about MC Frontalot</title>
		<link>http://dlweinreb.wordpress.com/2008/04/28/nerdcore-rising-a-documentary-about-mc-frontalot/</link>
		<comments>http://dlweinreb.wordpress.com/2008/04/28/nerdcore-rising-a-documentary-about-mc-frontalot/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 13:37:46 +0000</pubDate>
		<dc:creator>dlweinreb</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dlweinreb.wordpress.com/?p=30</guid>
		<description><![CDATA[Last night, I saw a screening of a new independent film called Nerdcore Rising.  The filmmakers follow a country-wide tour of a band called MC Frontalot, who are leaders in the genre of nerdcore hip hop, also known as geeksta rap.  (That&#8217;s the name of the rapper himself, as well as the band, I think.) [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Last night, I saw a screening of a new independent film called <a href="http://www.nerdcorerisingthemovie.com/" target="_blank">Nerdcore Rising</a>.  The filmmakers follow a country-wide tour of a band called <a href="http://en.wikipedia.org/wiki/MC_Frontalot">MC Frontalot</a>, who are leaders in the genre of <a href="http://en.wikipedia.org/wiki/Nerdcore_hip_hop" target="_blank">nerdcore hip hop</a>, also known as geeksta rap.  (That&#8217;s the name of the rapper himself, as well as the band, I think.) As I&#8217;m sure you can guess, it&#8217;s a cross between actual musical talent and self-deprecating ironic humor. Afterwards, we went to a party at <a href="http://www.mantrarestaurant.com/" target="_blank">Mantra Restaurant</a> in Boston, which was turned into a nightclub for the occasion.  <a href="http://www.itasoftware.com/" target="_blank">ITA Software</a>, my employer, sponsored the event.  (Of course, for us it was a recruiting event, at least putatively.  Come work here!)</p>
<p>The director, Negin Farsad, and many members of her team, were there and talked about the film.  At the end, the members of the band walked out and took questions.  Apparently there are quite a few nerdcore hip hop bands; estimates range from 50 to hundreds.</p>
<p>I&#8217;m not a rap fan at all, and I admit that I had trouble following the lyrics, which went by very quickly.  And at the nightclub, everything was much too loud, and the vocals were mixed much too low (as always seems to be the case in these venues).  Despite all that, I had a very good time.</p>
<p>Despite Farsad&#8217;s protestations that she only just learned how to make movies, it&#8217;s quite professionally done.  The editing is great, and keeps the movie moving right along.  It&#8217;s exciting and funny.  If you get a chance, check it out.  There&#8217;s plenty of music (with lyrics, yay!)  at <a href="http://frontalot.com/index.php/" target="_blank">MC Frontalot&#8217;s web site</a>.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dlweinreb.wordpress.com/30/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dlweinreb.wordpress.com/30/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dlweinreb.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dlweinreb.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dlweinreb.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dlweinreb.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dlweinreb.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dlweinreb.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dlweinreb.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dlweinreb.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dlweinreb.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dlweinreb.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dlweinreb.wordpress.com&blog=2003081&post=30&subd=dlweinreb&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dlweinreb.wordpress.com/2008/04/28/nerdcore-rising-a-documentary-about-mc-frontalot/feed/</wfw:commentRss>
		</item>
		<item>
		<title>European Common Lisp Meeting 2008</title>
		<link>http://dlweinreb.wordpress.com/2008/04/26/european-common-lisp-meeting-2008/</link>
		<comments>http://dlweinreb.wordpress.com/2008/04/26/european-common-lisp-meeting-2008/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 20:26:15 +0000</pubDate>
		<dc:creator>dlweinreb</dc:creator>
		
		<category><![CDATA[Event]]></category>

		<category><![CDATA[Lisp]]></category>

		<guid isPermaLink="false">http://dlweinreb.wordpress.com/?p=29</guid>
		<description><![CDATA[I had a great time at the European Common Lisp Meeting (ECLM) in Amsterdam, April 19-20, 2008. I met many of the important people in today&#8217;s Common Lisp world, an almost completely generation set of folks as compared to 15 years ago.  The papers were excellent, and demonstrated that Common Lisp is still a [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I had a great time at the <a href="http://weitz.de/eclm2008/" target="_blank">European Common Lisp Meeting</a> (ECLM) in Amsterdam, April 19-20, 2008. I met many of the important people in today&#8217;s Common Lisp world, an almost completely generation set of folks as compared to 15 years ago.  The papers were excellent, and demonstrated that Common Lisp is still a vibrant and uniquely powerful language. (I&#8217;m writing this on the plane back home, on my OLPC laptop, as I learn to touch-type with my big hands on the child-friendly little keys.)  Arthur Lemmens and Edi Weitz did a great job organizing and running the meeting.  Everything went entirely smoothly and I felt that everyone enjoyed it very much.</p>
<p><strong>InspireData</strong><br />
Jeremy Jones of Clozure Associates demonstrated <a href="http://www.inspiration.com/productinfo/inspiredata/index.cfm" target="_blank">InspireData</a>, an educational application that lets you analyze data and draw conclusions. The user interface and interaction design is superb. It performs very well, even on weak, old PC&#8217;s, which matters since that&#8217;s what many schools actually have. It has gotten excellent reviews and sales, and is widely used in schools.</p>
<p>The user would have no reason to know that it was written in Lisp.  No Lisp is exposed to the user.  They used<a href="http://www.lispworks.com/" target="_blank"> LispWorks</a>, since it runs on all of their target platforms (including Windows 95, as well as more modern Windows and MacOS X), it has a good interactive development environment, it provides a portable library for accessing the platform&#8217;s native menus and other widgets (called CAPI), and had favorable licensing terms. The rest of the graphics was done by calling the OpenGL graphics library, using a library from LispWorks. They found all of these technologies to work very well.</p>
<p>They wrote it as a contract job, building it to specs provided to them in a 200-page document.  It took 8 person-years of developers plus two person-years of Q/A, who were brought on board from the very beginning. It&#8217;s 270K lines of Lisp code plus 470 lines of C.</p>
<p>The primary advantage of using Lisp is that they could produce a prototype in only two months, and then do incremental additions and refinements. You might ask, why was this necessary if they had a 200-page requirements document?</p>
<ul>
<li>The specs were vague. It would have taken over a 1000-page spec to really be unambiguous. (In my opinion, that&#8217;s absolutely normal for software.)</li>
<li>The specs kept changing. (That always happens.  Always!)</li>
<li>In particular, the designers would change the specs because of what they saw the program doing. In other words, specifying it in advance would have been impossible in any number of pages. Design and implementation must be interleaved.</li>
<li>Even if the spec were known in advance. the best implementation techniques are not initially appanrent. Sometimes you have to get pretty far along in the implementation to realize that some atrchitectural decision did not work out well.</li>
</ul>
<p>Lisp is very malleable. Experience over the years has shown that even large Lisp systems are particulary easy to re-factor and even re-architect. (I have seen this over and over again.) In fact, Jeremy feels that they didn&#8217;t re-architect enough! (One usually hears the opposite lament.) He emphasized that iterative development &#8212; build, test, refine &#8212; was the only way to go and the only way they could have succeeded.</p>
<p>LispWorks performance in this application is excellent. As I could see in the demo, it is extremely responsive. Jeremy says he has never perceived any delay from the garbage collector. InspireData is a shining proof that real applications can be done just fine in Common Lisp.</p>
<p><strong>FEMLISP</strong></p>
<p>Nicholas Neuss (IANM, U. Karlsruhe) presented <a href="http://www.femlisp.org/" target="_blank">FEMLISP</a>, a system to do finite-element analysis (FEM). FEM is used for solving partial differential equations. It&#8217;s used to model things like convection, diffusion, viscous fluid flow, and so on.</p>
<p>I had thought this would just be a numeric library with  some API, and wondered why doing it in Lisp would be helpful or make any difference. But it&#8217;s not like that at all. First, choosing a good way to run FEM is a hard problem. I only sort-of understand the issues, but I got a sense of it. There&#8217;s a big issue of how you &#8220;discreetize&#8221; and solve the discrete problem. You also must make decisions about how to set the mesh. Second, you want an interactive environment that lets you display results graphically, and make small changes to the input spec and try again. Ideally, you&#8217;d like an expert system to make these decisions, but what he&#8217;s done so far he described as &#8220;rudimentary&#8221;.</p>
<p>He created small domain-specific language to represent of how to run a particular FEM problem. This lives in a Slime buffer and can be edited and recompiled quickly and conveniently.  It can display the history of the iterations so you can see what&#8217;s going on and refine your input. You can insert Lisp code into the input, for computing or debugging.</p>
<p>It runs on CMUCL, SBCL, LispWorks CL, and Allegro CL. He does graphics with OpenDX (Data Explorer), which was written by IBM and open-sourced. (He is considering switching to VTK.)</p>
<p>Why did he use Lisp?</p>
<ul>
<li>Dynamic typing worked out well</li>
<li>Macros and a few reader macros let him make an embedded domain-specific language easily</li>
<li>Dynamic testing and debugging (read-eval-print loop, etc.)</li>
<li>High performance compiled code (as compared to Guile and other Scheme implementations that he tried)</li>
<li>Common Lisp is stable; once you learn it, you know it</li>
<li>There is no system/user dichotomy</li>
<li>It only took 30K lines of code</li>
<li>There were lots of useful libraries</li>
</ul>
<p>Performance as compared to other available FEM packages is hard to determine for many reasons.  For example, who chooses the benchmark?  Can you find an informed third party to spec and judge the procedure? How do you know you&#8217;re not comparing apples and oranges?  (These are all standard pitfalls of benchmarking.) Also, he has not spent too much time on performance improvements anyway.</p>
<p>Nevertheless, he ran some basic comparisons against their company&#8217;s in-house FEM system, called M++, not only to measure speed but to make sure he got the same answers (he did). M++ turned out to be faster on small problems, but FEMLISP was faster on larger problems.</p>
<p>One reason for this is extremely interesting.  Apparently there is a certain well-known technique for speeding up FEM. He had implemented it, but they had not yet done so. This illustrates the principle that higher-productivity software development can lead to faster performance! When considering the effects on performance of using Lisp, take this into account.</p>
<p>In other tests he found that FEMLISP is about as fast as a leading commercial product (FEMLAB) for comparable accuracy, and much easier to use.</p>
<p>So far he has not tried to encourage other people to use it, mainly for political reasons (his boss wrote M++). He used FFI for certain existing libraries (e.g. LAPACK).</p>
<p><strong>Large Internet Systems</strong></p>
<p>Stefan Richter of freiheit.com talked about &#8220;Using Common Lisp for Large Internet Systems&#8221;. His company, <a href="http://www.freiheit.com" target="_blank">freiheit.com technologies</a> (it means &#8220;freedom&#8221;,  in the sense not having to use the Microsoft platform any more!) has built many commercial web sites in Java. They have 60 developers, most using Java, but also a 6-person Common Lisp group.  In an unusual twist, the manager of the group had to convince the reluctant programmers to use Common Lisp. Also, the clients had to be convinced that accepting a product in Common Lisp was OK.  They have delivered one Common Lisp application so far, a social marketing tool.</p>
<p>By &#8220;large internet systems&#8221; he mainly means scalable web sites.  Unfortunately, he has not actually built such a thing in Lisp yet.  The talk suggests approaches to the problem, but he did not have actual experiences to report.  He primarly prefers Lisp because he feels that Java is too verbose, and Ruby is basically like Lisp.</p>
<p>He explained a lot about how to build scalable and reliable servers (all of which I was very familiar with from my work at BEA and at ITA Software). Clusters, load balancers, stateless app tier, separate DBMS&#8217;s transactions and reporting, shared memcached distributed cache, keeping functionally separate data on separate DBMS&#8217;s, plus one idea that&#8217;s still new or in the short-term future: shared-nothing database clusters using &#8220;shards&#8221; with replicated data for reliability.  All of this is completely right, in my opinion, and I don&#8217;t think any of it is controversial.</p>
<p>Java has many good tools for doing such an archtecture: Tomcat providing a framework for servlets/JSP&#8217;s, a memcached client, Hibernate for database access, and even Hadoop (a free MapReduce implementation).</p>
<p>How does Common Lisp compare?  We have <a href="http://www.weitz.de/hunchentoot/" target="_blank">Hunchentoot</a> (a sophisticated HTTP server), <a href="http://common-lisp.net/project/cl-memcached/" target="_blank">cl-memcached</a> (a <a href="http://www.danga.com/memcached/">memcached</a> client), <a href="http://clsql.b9.com/" target="_blank">cl-sql</a> (to invoke relational DBMS&#8217;s), and two advanced tools for generating HTML: <a href="http://common-lisp.net/project/cl-weblocks/" target="_blank">Weblocks</a> (by Slava Akhmechet, I think), and <a href="http://common-lisp.net/project/ucw/" target="_blank">UnCommon Web</a> (by Marco Baringer).</p>
<p>He also suggests using <a href="http://www.cliki.net/cl-muproc">cl-muproc</a> (a library that provides Erlang semantics in Common Lisp, basically) which he feels could be a good basis for a Common Lisp <a href="http://en.wikipedia.org/wiki/MapReduce">MapReduce</a>. I don&#8217;t know exactly what he has in mind here, but apparently he has implemented this.</p>
<p>He doesn&#8217;t like existing conventional technology for generating web pages.  Servlets clumsily embed HTML in Java code; JSP&#8217;s clumsily embed Java code in HTML.  Using Common Lisp has many of the advantages of other popular languages that are being used to write HTML generation, such as Ruby, Groovy, and Python.  Lisp has major advantages: you don&#8217;t have to write out files in order to compile things; CLOS is very useful, including the MOP; we can avoid the need for XML because programs and data use the same format; and of course macros help in all kinds of ways.  (And, I was thinking, Common Lisp implementations typically execute code much faster than Ruby and Python!)</p>
<p>He talked about using continuations to save state between HTTP interactions.  (Many papers have been written on this topic.)  You want to be able to write a program in a normal style, that can say &#8220;do this web interaction&#8221; in the middle of any procedure; this makes flow of control much easier to understand.  A continuation saves stack and execution state across interactions.  He talked about Weblocks and how it uses continuations, as well as many of its other virtues (it sounds great, from what he said; I have yet to learn about it).</p>
<p>He feels that what&#8217;s needed now is to put it all together, and then write a good book about how to use it.  He points out that Ruby on Rails would never have taken off without the excellent book.  (I agree completely!)  He encourages us to write books, and help develop the framework libraries.</p>
<p>This all led to a lively discussion of continuations, particularly persistent continuations, and how to best implement them for Common Lisp.  Weblocks uses the cl-cont library.  Marco Baringer said that cl-cont&#8217;s continuation states are extremely large, leading to performance problems, although it would not be hard to improve this.</p>
<p>We also talked about just how reliable a system like this needs to be.  It often turns out that in exchange for a very small about of unreliability, you can make big improvements in simplicity and performance.  On a web site, it&#8217;s often quite acceptable to fail now and then, since the clients are human users who are much better at handling failure and retrying or finding alternatives.</p>
<p><strong>PWGL</strong></p>
<p>Kilian Sprotte described <a href="http://www2.siba.fi/PWGL/" target="_blank">PWGL</a>, a tool for music composition and analysis.  It is based on an earlier system called Patchwork, by Mikael Laurson in his 1996 doctor&#8217;s dissertation, at IRCAM, the famous music lab in Paris.  It is ten years old, and has always been in Common Lisp.  Originally it was developed in MCL; now it&#8217;s based on <a href="http://www.lispworks.com/" target="_blank">LispWorks</a> and runs on both Windows and Mac OS X.  It&#8217;s now being developed at Sibelius Academy in Finland.  It&#8217;s currently in beta-test, downloadable, and version 1.0 is expected later this year.</p>
<p>According to the description on the web site: PWGL is a free cross-platform visual language based on Common Lisp, CLOS and OpenGL, specialized in computer aided composition and sound synthesis. It integrates several programming paradigms (functional, object-oriented, constraint-based) with high-level visual representation of data and it can be used to solve a wide range of musical problems.</p>
<p>It&#8217;s a visual dataflow functional language; in some ways it&#8217;s like doing Lisp by drawing boxes and lines.</p>
<p>It uses OpenGL for graphics, the PortAudio library for recording, playing back, and basic sound synthesis, and the libsndfile library for reading and writing files containing sampled sound.  (It was interesting to see how many Lisp systems are capable of using non-Lisp libraries easily.  This is another important counter-argument to the objection that Lisp has too few libraries.)</p>
<p><strong>Embeddable Common Lisp (ECL)</strong></p>
<p>Juan Jose Garcia-Ripoll described <a href="http://common-lisp.net/project/cl-emb/" target="_blank">Embeddable Common Lisp</a>.  ECL is not just for embedding: it&#8217;s a full Common Lisp implementation.  It&#8217;s a descendant of Kyoto Common Lisp by Taiichi Yuasa and Masami Hagiya at the Research Institute.  Juan is the maintainer.</p>
<p>It is designed for portability.  Rather than generating machine code for various processors, it generates C, and then allows the target host&#8217;s C compiler to produce machine language.  This approach lets it take advantage of the target compiler&#8217;s optimizations, and specific knowledge of the target architecture.  (However, compilation is not very fast.)  All platforms these days include a free C compiler (even Microsoft).  It makes minimal architectural assumptions: a pointer can be cast to an int, and C functions can be called with many arguments, and a variable number of arguments.</p>
<p>It supports a wide range of operating systems: Linux, NetBSD, FreeBSD, OpenBSD, Windows, Solaris, and Mac OS X.</p>
<p>The core and the Lisp interpreter are written in C; the rest is in Lisp.  It borrows the Boehm-Weiser conservative GC, and provides CLOS with the PCL implementation.  It uses native threads.  It also contains a byte-code compiler and interpreter (instead of direct interpretation of Lisp as s-expressions).  The implementation of subtypep uses the efficient method described by Henry Baker, and works with CLOS types.</p>
<p>It can build standalone executables and dynamically-linked libraries, and this is why it&#8217;s called &#8220;embeddable&#8221;.  But it can be used as a regular Common Lisp implementation too, so don&#8217;t be put off by the name!</p>
<p>For more details, see his <a href="http://ecls.wiki.sourceforge.net/space/showimage/eclm2008.pdf">paper</a>.</p>
<p><strong>House Developer</strong></p>
<p>Kristoffer Kvello of Selvaag told us about <a href="http://dp.com/pdf/design++/selvaag.pdf">House Developer</a>, which is basically a CAD system for architects.  It allows the architect to draw a very high-level drawing, and it takes care of filling in myriad specifics.  It decides where to put windows and doors, and which way the doors should swing.  It places electrical outlets and switches.  It decides on wall types, wall offsets, wall junctions, heaters, fire exit paths, and so on.</p>
<p>There are many details, all of which must conform to regulations, company rules, and best practices.  Doing all this by hand is costly, time-consuming, and error-prone.  Automating it reduces errors, and lets the architect try lots of ideas and see their consequences promptly.</p>
<p>This is, in many ways, a classic rule-based expert system.  They started writing it in 1994, using Knowledge-Based Engineering (KBE) technology of the time, which was primarily in Lisp.  However, the rules are not like classic Artificial Intelligence rules; they are more like constraints.  An example:</p>
<h4>
<pre>(define-attribute area (window)
    (* ?width ?height))</pre>
</h4>
<p>This defines a constraint that gets recomputed as necessary.  These rules can use the full power of Lisp.</p>
<p>The core of the system is written in <a href="http://www.franz.com/">Allegro CL</a>.  There is a Java-based user interface, that sends S-expressions to the core.  The core sends XML replies back to the user interface.  It uses many available libraries: asdf, zip, cl-sql, cl-utilities, s-xml, aserve, Expresso Toolkit, and Screamer.</p>
<p>The <a href="http://exp-engine.sourceforge.net/">Expresso Toolkit</a> knows the STEP (Standard Exchange of Product data) and EXPRESS (an ISO standard modeling language), which are important standards in the architecture industry.</p>
<p><a href="http://clocc.sourceforge.net/clocc/src/screamer/">Screamer</a> supports &#8220;non-deterministic programming; it does constraint satisfaction with mixed systems of numeric and symbolic constraints, based on a substrate that supports backtracking and undoable side effects.</p>
<p>The advantages of using Lisp for this system include:</p>
<ul>
<li>Interactive development, with fast recompilation, incremental changes, no need to constantly re-create the global state</li>
<li> Break loops, with the ability to fix things and then restart</li>
<li> Reader macros, so that we could customize the syntax</li>
<li> Advice, so that we could customize behavior</li>
<li> It&#8217;s easy to inspect the image to find out what to customize</li>
<li> Extensibility in general</li>
<li> handler-bind, for use on our test framework</li>
<li> Many available relevant libraries, which worked fine</li>
</ul>
<p>There have not been a lot of users so far, but they are planning to deliver it to a large customer soon.</p>
<p><strong>High-Performance Architecture</strong></p>
<p><a href="http://www.cl-user.net/asp/persons/marc.battyani" target="_blank">Marc Battyani</a> discussed a high-performance computer architecture, using Field-Programmable Gate Arrays (FPGA&#8217;s) that are programmed using a high-level special-purpose language, implemented in Lisp.  He has a computer based on a Stratix II FPGA with memory and network.  The FPGA has modules on it such as adders, multipliers, I/O pins, memory, and so on. Programming one consists of hooking up the modules up to perform a particular special-purpose function.  A problem with FPGA technology is that programming them is so hard; the novel feature here is to use a Lisp-based language, called HPCC, that compiles a high-level description into the FPGA&#8217;s program.</p>
<p>They have implemented two applications so far.  One prices exotic financial instruments using Monte Carlo simulation.  Currently, this kind of thing is done with grids of 10K-10K boxes.  The other does multicast networking at 1 million messages per second.  They plan to get funding, hire more Common Lisp programmers, and do more applications.</p>
<p><strong>Cells</strong></p>
<p>Ken Tilton talked about his <a href="http://common-lisp.net/project/cells/" target="_blank">Cells</a> library, a dataflow extension to CLOS.  The basic idea is that the values slots are determined by a formula, like the cells in a spreadsheet.  Cells tracks dependencies between cells and propagating values.  He demonstrated widgets that grow and reshape graphics automatically.</p>
<p><strong>Announcements</strong></p>
<p>Randall Pitts is looking for Lisp programmers to work on a speech understanding project, that would help answer email, help call center agents, etc.  They&#8217;re dealing with language, grammar, and syntax.  You must work in Germany.</p>
<p>Nick Levine is looking for work.  He has 20 years of Lisp experience and has been consulting for seven years.</p>
<p>Marty Simmons of LispWorks is looking for applications that use concurrency, to help test their new thread support.</p>
<p><strong>One parting thought</strong></p>
<p>One of the most widespread complaints about Common Lisp is the lack of available libraries.  However, in several practical applications, we see here that there are many available libraries for Common Lisp that work well and can be built on.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dlweinreb.wordpress.com/29/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dlweinreb.wordpress.com/29/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dlweinreb.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dlweinreb.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dlweinreb.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dlweinreb.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dlweinreb.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dlweinreb.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dlweinreb.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dlweinreb.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dlweinreb.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dlweinreb.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dlweinreb.wordpress.com&blog=2003081&post=29&subd=dlweinreb&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dlweinreb.wordpress.com/2008/04/26/european-common-lisp-meeting-2008/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The OLPC&#8217;s Bitfrost security mechanism: my replies to criticism thereof</title>
		<link>http://dlweinreb.wordpress.com/2008/04/12/the-olpcs-bitfrost-security-mechanism-my-replies-to-criticism-thereof/</link>
		<comments>http://dlweinreb.wordpress.com/2008/04/12/the-olpcs-bitfrost-security-mechanism-my-replies-to-criticism-thereof/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 14:30:37 +0000</pubDate>
		<dc:creator>dlweinreb</dc:creator>
		
		<category><![CDATA[One Laptop Per Child]]></category>

		<guid isPermaLink="false">http://dlweinreb.wordpress.com/?p=28</guid>
		<description><![CDATA[The OLPC&#8217;s security mechanism is called Bitfrost and was designed by Ival Krstic.  It is novel in two ways.  First, the set of threats it is concerned with are tailored to the unusual mission of the OLPC.  Second, the fundamental philosophy and mechanisms are different from what most of us are used [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The OLPC&#8217;s security mechanism is called Bitfrost and was designed by Ival Krstic.  It is novel in two ways.  First, the set of threats it is concerned with are tailored to the unusual mission of the OLPC.  Second, the fundamental philosophy and mechanisms are different from what most of us are used to.  Ivan gave a talk this week at ITA Software&#8217;s Technical Seminar series, explaining Bitfrost.  You can read his paper about it <a title="bitfrost paper" href="http://radian.org/~krstic/bitfrost_2007.pdf" target="_blank">here</a>.</p>
<p>A <a title="patterson" href="http://www.cosic.esat.kuleuven.be/publications/article-1042.pdf" target="_blank">paper</a> castigating Bitfrost, called &#8220;Freezing More Than Bits: Chilling Effects of the OLPC XO Security Model&#8221;, was recently written by Meredith Patterson (U. Iowa) and Len Sassaman and David Chaum (both of KULeuven in Belgium).</p>
<p>I could not find Patterson at U. Iowa&#8217;s web site or anywhere else, but she turns out to be Sassaman&#8217;s wife.  Len Sassaman is a grad student, &#8220;cypherpunk&#8221;, and privacy advocate.  He was the security architect for Anonymizer and wrote the Mixmaster anonymous remailer.  David Chaum is well-known as the inventor of cryto protocols for anonymous electronic cash, and currently heads the Punchscan project, an end-to-end auditable voting interface.</p>
<p>As you will see, their paper has a lot to say about anonymity and voting.  At first, you might not think of these as topic germane to the OLPC, but the authors feel otherwise.  This is their primary area of interest, and so they have brought to bear their own agenda on OLPC.  You can decide the extent to which that&#8217;s appropriate.</p>
<p>Here are the points they seem to be making, as far as I understand, with my comments and replies in square brackets.</p>
<p>Bitfrost isn&#8217;t finished, but some OLPCs are in the field anyway.  [True.]</p>
<p>Eventually, it will be necessary to have a finalized and detailed specification for Bifrost that can be audited and tested. [Sure.]</p>
<p>Bitfrost has not been submitted to a recognized standards body.  [First, so what?  Second, it's clearly far too early to do that.  The right time to standardize is after there has been a great deal of experience.]</p>
<p>The prototypes that they saw did not have the LED&#8217;s that show that the camera and microphone are on.  [Current OLPC's do have this, but they didn't know whether it would happen or not.]</p>
<p>The stored digital identity includes the child&#8217;s name and photograph, so that you can authenticate whether a given person matches the digital identity.  They &#8220;question the need for such invasive measures.&#8221;  [But they don't go into more detail about what particular problem they are concerned with.]</p>
<p>&#8220;The data recovery process should be decoupled from the identity and authentication component.&#8221;  [I was not able to follow their reasoning about why this is important.]</p>
<p>A sophisticated attacker could set up a bogus backup service if they can gain access to the key store.  How would they do that?  The paper cites &#8220;black-bag cryptanalysis&#8221; and &#8220;aluminum-briefcase cryptanalysis&#8221;.  The former means burglary (the use of the word &#8220;cryptanalysis&#8221; is sardonic/ironic).  The latter is a term that the authors made up themselves (one of them boasts of this in a blog entry) but apparently also means burglary. [Well, you have to pick and choose what attacks you want to prevent against.  What if someone goes to the real server and puts a gun to the head of the operator?  You just can't protect against every conceivable possibility.]</p>
<p>P_IDENT says that all communications such as email and instant messaging are cryptographically signed.  It&#8217;s not explained exactly how this works, so they speculate.  They assert that signing implies non-repudiability of all signed messages [note: non-repudiation means that the receiver can prove that the sender really sent this message, and the sender can't deny it unless he claims that his own key has been compromised].  &#8220;Ergo, it is impossible for XO users to use any form of anonymous communication with confidence.&#8221; They&#8217;re saying that the signing is bad because you can&#8217;t turn it off, or you have to know to turn it off.  So anyone who intercepts your messages knows who you are, so speaking out against your government or whistleblowing against a corporation could backfire on you.  It&#8217;s also not good for doing secret ballots. [I guess this is all true, but if I sent an email right now, I would hardly depend on it to be untraceable to me, even without a digital signature.  Perhaps anonymity should be added to the goals for Bitfrost, if they intend for it to be used in those ways.  But it's really for childhood education, not voting. It's a lot of work to add on every requirement in the world and try to do them all.  If we were designing a voting machine, security goals would be different.  There may be very good reasons that anonymity was not added as a goal, too; I'd like to hear from OLPC about this.</p>
<p>Because of the digital signing, a child's Internet access can be "cut off at the source", which would be traumatic.  [Oh, come on!]</p>
<p>The point about &#8220;Imagined Communities&#8221;.  [I don't know what they're talking about; evidently I'd have to read one of the citations.]</p>
<p>Most important, they do not provide any suggestions about what they&#8217;d do to mitigate what they consider to be problems.  In my opinion, a criticism carries much less weight without specific counterproposals, since then you can evaluate the drawbacks and tradeoffs required by those counterproposals.</p>
<p>Now that Ivan Krstic has left OLPC, it is not clear to what extent Bitfrost&#8217;s implementation will be finished and polished.  I heard one rumor on the net that OLPC plans to replace it with something else, but I have no idea whether that&#8217;s actually true.  There are a lot of rumors going around about OLPC, and I&#8217;ll wait for positive confirmation before repeating any more of them.</p>
<p>Personal news, speaking of OLPC: Federal Express lost the OLPC that was originally sent to me (or it was stolen).  It was basically impossible to get my money back from FedEx, since they required some paperwork from the shipper (Brightstar), who never answered my calls.  I complained to OLPC, but for a while nothing happened.  Meanwhile someone at ITA had bought one for his kid, who didn&#8217;t like it, so he sold his to me.  Then, OLPC decided to simply send me another one!  Good for them!  I&#8217;m selling the second one to a friend.</p>
<p>So now I have my very own green-and-white ultra-cute laptop.  I&#8217;ve upgraded it to the latest release and started to learn to use Sugar and the installed applications.  Maybe someday I&#8217;ll punt Sugar and just use it as a Linux machine, but for now I want to try it out.  The most important thing, as I knew it would be, is learning to touch-type on the little keyboard.  But I can hunt-and-peck, more easily than I could on something like a Blackberry, so I can&#8217;t complain.  I&#8217;m going to the European Common Lisp Meeting in Amsterdam next week, and I&#8217;ll bring it along and play with it more.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dlweinreb.wordpress.com/28/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dlweinreb.wordpress.com/28/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dlweinreb.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dlweinreb.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dlweinreb.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dlweinreb.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dlweinreb.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dlweinreb.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dlweinreb.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dlweinreb.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dlweinreb.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dlweinreb.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dlweinreb.wordpress.com&blog=2003081&post=28&subd=dlweinreb&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dlweinreb.wordpress.com/2008/04/12/the-olpcs-bitfrost-security-mechanism-my-replies-to-criticism-thereof/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What Conditions (Exceptions) are Really About</title>
		<link>http://dlweinreb.wordpress.com/2008/03/24/what-conditions-exceptions-are-really-about/</link>
		<comments>http://dlweinreb.wordpress.com/2008/03/24/what-conditions-exceptions-are-really-about/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 01:22:42 +0000</pubDate>
		<dc:creator>dlweinreb</dc:creator>
		
		<category><![CDATA[Lisp]]></category>

		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://dlweinreb.wordpress.com/?p=27</guid>
		<description><![CDATA[The &#8220;condition&#8221; (exception) feature of Common Lisp is important, but widely misunderstood, as can be seen by the frequent confusion between &#8220;conditions&#8221; and &#8220;errors&#8221;.  I&#8217;ve been thinking about conditions and exceptions for many years, and here&#8217;s how I explain them.
Notes: I&#8217;m going to avoid using the word &#8220;error&#8221;, which has become overloaded.  Some [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The &#8220;condition&#8221; (exception) feature of Common Lisp is important, but widely misunderstood, as can be seen by the frequent confusion between &#8220;conditions&#8221; and &#8220;errors&#8221;.  I&#8217;ve been thinking about conditions and exceptions for many years, and here&#8217;s how I explain them.</p>
<p>Notes: I&#8217;m going to avoid using the word &#8220;error&#8221;, which has become overloaded.  Some of the following applies to Java, but not all; I might write about Java exceptions in the future.  I&#8217;ll omit the use of explicit  catch/throw, for brevity.  I&#8217;m only talking here about the simple heart of the condition feature, not fancy      things like restarts.</p>
<p><b>Contracts, Bugs, and the Failstop Principle</b></p>
<p>Every function has a &#8220;contract&#8221; which defines what the function is supposed to do.  If any function call  violates the contract, the program must be incorrect: a &#8220;bug&#8221; has happened.  The actual incorrect behavior might have started any time before we detect that there&#8217;s a bug.</p>
<p>If a program detects that a bug has happened, it should stop.  That&#8217;s because if it keeps on going, there&#8217;s no way to know what it might do: write the wrong data to a file or database, display wrong answers, hang, etc.  This is called the &#8220;failstop&#8221; principle.</p>
<p>(Exactly what &#8220;stop&#8221; means depends on the context.  An interactive command might return to its event loop.  A server thread might go back to its wait-for-input step.  These are not perfectly safe, since the program might have corrupted transient state before the bug was detected.  A safer way to stop is to kill the entire process.  In Erlang, you only have to kill a thread, since each thread has its own transient state.)<br />
<b><br />
Outcomes</b></p>
<p>The contract of a function specifies, among other things, the possible &#8220;outcomes&#8221; of calling the function.  There is always one &#8220;usual&#8221; or &#8220;straight-line&#8221; kind of outcome, and then there can be zero or more &#8220;unusual&#8221; outcomes.</p>
<p>In Common Lisp, every function call either returns zero of more values, or else signals a condition.  The caller discriminates on which kind of outcome this is by scrutinizing the values returned, or scrutinizing the condition that was signaled.  The contract specifies the circumstances under which each kind of outcome happens, saying what values are returned or what condition object is signaled (plus what side-effects occurred) for each kind of outcome.</p>
<p>For example, suppose we call <code>(open pathname :if-does-not-exist nil)</code>.  Possible kinds of outcome are:</p>
<ul>
<li>It returns a stream object.  This means that the specified file has been opened for input.</li>
<li>It returns <code>nil</code>.  This means that there was no file by this name in the file system.  There are no side-effects.</li>
<li>It signals <code>inappropriate-wildcard</code>.  This means that the pathname had was a wildcard pathname; it doesn&#8217;t make sense to open one.  There are no side-effects.</li>
<li>It signals <code>undefined-logical-host</code>, and the instance&#8217;s <code>undefined-logical-host-name</code> is the name of the logical host.  This means that it was a logical pathname whose host was not found in the set of translations.</li>
</ul>
<p>(There are many other kinds of outcome.  Sadly, Common Lisp does not actually specify what condition classes are signaled.  You own contracts always should!)</p>
<p>If the call to open does any of these things, it is working properly and there is no bug.  If the call to <code>open</code> returns something other than <code>nil </code>or an open-for-input stream to the specified file, or if it signals any other condition class, a bug has happened and the program should stop.</p>
<p>Conditions and bugs are entirely orthogonal.  If you call open (as shown above) with a wildcard pathname, and it signals <code>inappropriate-wildcard</code>, that&#8217;s not a bug; that&#8217;s exactly what it&#8217;s supposed to do.  If you call open and it returns a symbol, that&#8217;s bug, but no condition is signaled.</p>
<p>Commonly, when a function call ends with an unusual outcome, that&#8217;s specified to mean that there were no side-effects.  There&#8217;s nothing theoretically wrong with specifying in the contract that a certain unusual outcome also has some side effects, but it&#8217;s not customary.</p>
<p><b>Tasteful Contract Design</b></p>
<p>When you design a function, you should first think of all the possible kinds of (correct) outcome.  Then you should decide how each outcome will look to the caller: certain specific returned value(s), or certain specific conditions.  This all becomes part of the contract for the function.</p>
<p>The general principle for making this choice is to consider which outcomes are the ones that a programmer is likely to expect and desire.  You can&#8217;t always know for sure: different programmers might call the same function with different expectations.  But it&#8217;s usually not hard to guess accurately.  The &#8220;usual&#8221;, &#8220;straight-line&#8221; outcomes should always be a kind of returned value.  The more unusual outcomes seems like it will be expected and important, the more likely you&#8217;d be to represent it by a kind of returned value than by a condition.  All other unusual outcomes should be indicated by signaling conditions.</p>
<p>The main clue is the appearance of the function call.  That&#8217;s mainly the function&#8217;s name, but it can also include the names of keyword arguments.</p>
<p>For example, <code>(open "/a/b")</code> should be defined to return a value only when it has actually opened a file, in which case it returns a stream.  All other outcomes should be signals of conditions.  However, <code>(open "/a/b" :if-does-not-exist nil)</code> suggests strongly that some outcomes (there&#8217;s no &#8220;b&#8221; in directory &#8220;/a&#8221;, or directory &#8220;/a&#8221; does not exist) should be indicated by returning <code>nil</code>, and conditions should be used for other outcomes.<br />
<b><br />
Why Conditions are Better Than Special Return Values</b></p>
<p>It&#8217;s sometimes tempting to indicate unusual outcomes by having a function return a special value, or by having it return a second value.  However, there are two drawbacks to this.</p>
<p>First, experience over many long years has shown that programmers often forget to check for the special values.  Coding is hard and demands a lot of concentration.  When a programmer is hard at work figuring out how to write an algorithm, it can be difficult to keep in mind all the possible outcomes of every call.  There&#8217;s no excuse for it, but in real life, this is a common bug.</p>
<p>Bruce Eckel, in <i>Thinking in Java, 2nd edition</i>, correctly says:</p>
<p>In C and other earlier languages, there could be several of these formalities, and they were generally established by convention and not as part of the programming language. Typically, you returned a special value or set a flag, and the recipient was supposed to look at the value or the flag and determine that something was amiss. However, as the years passed, it was discovered that programmers who use a library tend to think of themselves as invincible &#8212; as in, &#8220;Yes, errors might happen to others, but not in my code.&#8221; So, not too surprisingly, they wouldn&#8217;t check for the error conditions (and sometimes the error conditions were too silly to check for [such as all the error values from printf]). If you were thorough enough to check for an error every time you called a method, your code could turn into an unreadable nightmare. Because programmers could still coax systems out of these languages they were resistant to admitting the truth: This approach to handling errors was a major limitation to creating large, robust, maintainable programs.</p>
<p>If an algorithm forgets to check for the special values, it will proceed as if the usual outcome happened.  This means that the program is malfunctioning.  A bug has happened but it has not been detected.</p>
<p>But if that unusual outcome is expressed as a signal of a condition, and the programmer forgets to handle it, the program will stop.  This is what we want: failstop behavior.</p>
<p>(Exactly what &#8220;stop&#8221; means depends on context.  In a server, there would probably be a handler-bind near the base of the stack that handles all conditions.  This &#8220;ultimate handler&#8221; is called when a bug has been detected.  It might write a stack trace to a log file, and then cause the thread to be restarted, for example.)</p>
<p>Second, even if you do remember to check for the special value, it often makes the program cluttered and harder to read.  This is particularly annoying in Lisp, where it&#8217;s customary to write applicative forms where arguments to one form are themselves non-trivial forms.</p>
<p>I only have room here for a short example.  The problems discussed above come up more often, and are harder to deal with, in much larger programs.</p>
<p>Suppose we have a configuration module that associates keys with URL&#8217;s.  Looking up a key has two possible outcomes: the URL is found (usual) and no URL is found (unusual).  The function <code>url-host-name</code> extracts the host name from an URL. If the URL does not specify a host name, that&#8217;s an unusual outcome.  Finally, <code>make-host</code> creates and returns a host object, with the given host name.</p>
<p>We want to write a new function, <code>get-host-from-configuration</code>, which takes a configuration and key, and returns the host name of the specified configuration entry.  There are two possible outcomes: the host, or an indication that we could not obtain it.</p>
<p>Version 1 disregards unusual outcomes:</p>
<pre>(defun get-host-from-configuration (configuration key)
  "Returns the host associated with the key and the configuration."
  (make-host :name (url-host-name (read-url configuration key))))</pre>
<p>Version 2 indicates unusual outcomes by returning <code>nil</code>:</p>
<pre>
(defun get-host-from-configuration (configuration key)
  "Returns the host associated with the key and the configuration,
or nil if it cannot be obtained."
  (let ((url (read-url configuration key)))
    (when url
      (let ((host-name (url-host-name url)))
        (when host-name
          (make-host :name host-name))))))
</pre>
<p>Version 3 uses conditions:</p>
<pre>
(defun get-host-from-configuration (configuration key)
  "Returns the host associated with the key and the configuration,
  signal host-not-in-config if the host cannot be found."
  (handler-case
        (make-host :name (url-host-name (read-url configuration key)))
    ((configuration-entry-not-found url-has-no-host) ()
        (error 'cannot-make-host-from-key :key key))))
</pre>
<p>Version 1 is nice and simple, but it doesn&#8217;t take into account the possibility of the unusual outcomes of its callees.  Its contract cannot possibly be fulfilled.</p>
<p>Version 2 works, but it loses the applicative form.  Every time we call a function, we have to stop, give the result a name, and check it before we can go on.</p>
<p>Version 3 keeps the applicative form.  As long as everything has the usual outcome, it&#8217;s just like the simple code in Version 1.  The &#8220;straight-line&#8221; code path is all in one place and easy to see.  The infrequent unusual condition handlers are out of the way.</p>
<p><b>Conditions at the Right Level of Abstraction</b></p>
<p>You may be thinking: why not fix Version 1 by keeping the code, and just changing its contract to say</p>
<p>&#8220;Returns the host associated with the key and the configuration, signals <code>configuration-entry-not-found</code> if the URL was not found in the configuration, and signals <code>url-has-no-host</code> if the URL doesn&#8217;t have a host.&#8221;</p>
<p>In other words, we could make the callees use conditions, as with version 3, but just let the conditions propagate to the caller.</p>
<p>The problem with this is that it&#8217;s a modularity violation.  The caller of <code>get-host-from-configuration</code> has no business knowing that there are URL&#8217;s involved at all.  That&#8217;s an underlying implementation detail.  Instead, <code>get-host-from-configuration</code> should indicate the unusual outcome, that it can&#8217;t make the host object, by signaling the <code>cannot-make-host-from-key</code> condition.  It&#8217;s OK for the condition object to contain the key, since our caller clearly knows about the concept of keys since that&#8217;s an argument to <code>get-host-from-configuration</code>.</p>
<p>Similarly, it&#8217;s good for the <code>read-url</code> function applied to a configuration to indicate that it can&#8217;t find an entry by signaling <code>configuration-entry-not-found</code> rather than, say, <code>file-not-found</code> if the whole configuration file was missing.  The caller of <code>read-url</code> has no business knowing whether the configuration is stored in a file or a database.  We might even have two subclasses of configuration, <code>file-configuration</code> and <code>database-configuration</code>, but this would be hidden from the caller of <code>get-host-from-configuration</code>.  Whether the configuration is stored in a file or a database is an internal implementation detail.</p>
<p><b>condition, serious-condition, and error Are Meaningless</b></p>
<p>Common Lisp defines three base condition classes named <code>condition</code>, <code>serious-condition</code>, and <code>error</code>.  This is based on the misconception that you can tell whether the signaling of a condition is an &#8220;error&#8221; (bug) simply by knowing the class.  But you can&#8217;t.  Whether the signaling of a condition is a bug or not depends entirely on whether the function signaling it is defined to do so, or not.  If I were designing a new dialect of Lisp, I would omit the classes <code>serious-condition</code> and <code>error</code>.</p>
<p><b>Why This Philosophy is Unconventional</b></p>
<p>Most explanations of conditions put little or no emphasis on functions having contracts that specify conditions.  Few other explanations refer to the propensity of programmers to neglect to check special &#8220;error codes&#8221;.</p>
<p>Major Lisp texts, such as &#8220;Practical Common Lisp&#8221; and &#8220;Common Lisp: The Language, 2nd Edition&#8221; start off by acknowledging that signaling does not always mean that there&#8217;s an &#8220;error&#8221;, but they soon give up on that distinction.  The word &#8220;error&#8221; is often used to sometimes mean what I call an &#8220;unusual outcome&#8221; and other times used to mean what I call a &#8220;bug&#8221;.  I see these as extremely different phenomena that must be carefully distinguished.</p>
<p>The fact that the usual function for signaling a condition is called <code>error </code>greatly amplifies the confusion.  If I were designing a new Lisp dialect, I would not call it that.</p>
<p>Bruce Eckel&#8217;s book says:</p>
<p>With an exceptional condition, you cannot continue processing because you don&#8217;t have the information necessary to deal with the problem in the current context. All you can do is jump out of the current context and relegate that problem to a higher context. This is what happens when you throw an exception.</p>
<p>As you see, that&#8217;s not how I would explain it at all.  An unusual outcomes isn&#8217;t even necessarily a &#8220;problem&#8221;.  It doesn&#8217;t mean you &#8220;cannot continue processing&#8221; any more than returning from the function means that.</p>
<p>Joel Spolsky <a href="http://www.joelonsoftware.com/items/2003/10/13.html" title="Joel" target="_blank">doesn&#8217;t like exceptions at all</a>.  He considers them like &#8220;goto&#8221; statements, which everybody &#8220;considers harmful&#8221;, whereas I think that structured non-local exits do not have the problems cited in the &#8220;considered harmful&#8221; paper.  He objects that &#8220;there is no way to see which exceptions might be thrown and from where&#8221;.  But how are you supposed to program with functions whose contracts you do not know, exceptions or no exceptions?  He says &#8220;they create too many possible exit points&#8221;; but whether you express unusual outcomes with exceptions or with special returned values, there are just the same number of them.  He advocates using error codes, even though he admits that it makes programs far bulkier and makes it impossible to nest function calls.</p>
<p><b>Implementation and Portability Considerations</b></p>
<p>The Common Lisp specification makes tradeoffs between clean contracts and speed.  For example, the addition function &#8220;+&#8221; ideally ought to be defined to signal a condition when either argument is a symbol.  But, in order to allow generation of fast code on non-specialized hardware, its contract says that given a symbol, it may either signal, or return some integer value.</p>
<p>Some contracts in Common Lisp are deliberately incomplete in order to allow some implementations to add non-standard extensions.</p>
<p>Many contracts in Common Lisp do not specify particular condition classes to be signaled, but rather erely say that some outcome&#8217;s behavior is &#8220;a condition is signaled&#8221; without specifying a particular condition class nor instance variable values.</p>
<p><b>Topics For the Future</b></p>
<p><code>unwind-protect</code>, unhandled conditions in cleanup handlers, chained conditions, Java exceptions, debugging, <code>handler-bind</code>, handling all condition classes, <code>*break-on-signal*</code>, polymorphism, <code>with-error-context</code>, condition names should say what happened, not where it happened.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dlweinreb.wordpress.com/27/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dlweinreb.wordpress.com/27/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dlweinreb.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dlweinreb.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dlweinreb.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dlweinreb.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dlweinreb.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dlweinreb.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dlweinreb.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dlweinreb.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dlweinreb.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dlweinreb.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dlweinreb.wordpress.com&blog=2003081&post=27&subd=dlweinreb&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dlweinreb.wordpress.com/2008/03/24/what-conditions-exceptions-are-really-about/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How To Decide Whom To Vote For in the US Presidental Primary</title>
		<link>http://dlweinreb.wordpress.com/2008/01/16/how-to-decide-whom-to-vote-for-in-the-us-presidental-primary/</link>
		<comments>http://dlweinreb.wordpress.com/2008/01/16/how-to-decide-whom-to-vote-for-in-the-us-presidental-primary/#comments</comments>
		<pubDate>Wed, 16 Jan 2008 12:27:37 +0000</pubDate>
		<dc:creator>dlweinreb</dc:creator>
		
		<category><![CDATA[Politics]]></category>

		<guid isPermaLink="false">http://dlweinreb.wordpress.com/2008/01/16/how-to-decide-whom-to-vote-for-in-the-us-presidental-primary/</guid>
		<description><![CDATA[And now for something completely different. I don&#8217;t usually post about politics, but what with all the election coverage I hear every day during my commute, I can&#8217;t help but think about it.  I am basically a &#8220;progressive&#8221;.  Perhaps my politics is &#8220;defined&#8221; by the fact that I read The New Republic and [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>And now for something completely different. I don&#8217;t usually post about politics, but what with all the election coverage I hear every day during my commute, I can&#8217;t help but think about it.  I am basically a &#8220;progressive&#8221;.  Perhaps my politics is &#8220;defined&#8221; by the fact that I read The New Republic and The New Yorker, and listen to National Public Radio.  So here&#8217;s how I look at the Presidential election.</p>
<p>Because the primary elections are in progress, we hear mostly about them.  But what&#8217;s really important is the general election.  Any of the major Democratic candidates is way, way better than any of the major Republican candidates.  So, the only thing that matters is for a Democrat to win.  And therefore, the only criterion that matters for the primary is to vote for the Democrat who is most likely to be able to win in the general election.</p>
<p>That means that my primary vote should be based on how I expect everyone else to vote in the general election.</p>
<p>What criteria will everybody else be using to make their decision in the general election?</p>
<p>Polls tell us relatively little.  As we all know, there have been major failures in polling already.  Many voters don&#8217;t make up their mind until they are actually in the voting booth.  I believe that what voters say to pollsters is influenced by what they think the pollsters want to hear, and the way that they&#8217;d like to sound and to perceive themselves, which is not all that accurate a predictor of how they will actually vote. Things keep changing, often rapidly: one &#8220;gaffe&#8221; can have a big effect.  Polls asking &#8220;if <i>x </i>and <i>y</i> were candidates in the general election, who would you vote for?&#8221; are particularly dubious, since so much will change between now and general election day.</p>
<p>I believe that Iowa and New Hampshire tell us very little.  They are quite atypical in so many ways, particularly that New Hampshire allows independents to vote Democratic in the primaries.  Obviously Michigan tells us nothing about the Democratic primary race, since the only major candidates on the ballot is Clinton.</p>
<p>Some people mostly care about the real issues and/or ideology.  The Democratic candidates are quite close on all the issues.  (The differences that are being debated now are very minor.)  So from the point of view of my primary voting decision, none of that matters.</p>
<p>A lot more people vote on what they perceive as the &#8220;character&#8221; of the candidate.  Among the most important &#8220;character&#8221; criteria are:</p>
<ul>
<li>Is he/she someone I&#8217;d enjoy spending an evening with?</li>
<li>Is he/she the &#8220;kind&#8221; of person who respects my &#8220;kind&#8221; of person?</li>
<li>Is he/she optimistic?</li>
<li>Is he/she female?</li>
<li>Is he/she black?</li>
<li>Is he/she &#8220;cold&#8221;?</li>
</ul>
<p>For example, last time, I believe that John Kerry was perceived by many voters as being an &#8220;Eastern elite liberal sushi-eating Chardonnay-sipping type who snickers at ordinary working-class people&#8221;.  It makes no difference whether that&#8217;s true or not; the only thing that matters is the perception.  George W. Bush affects a Texas accent (gee, his dad and brother don&#8217;t talk that way!), is seen in jeans clearing sagebrush from his ranch (or whatever), and so on, portraying himself very differently from Kerry.</p>
<p>(The fact that W. avoided war service, while Kerry served honorably, was a cause of cognitive dissonance to some voters.  They were looking hard for an excuse to dismiss this fact, and the &#8220;Swift Boat&#8221; people, no matter how implausible their claims, gave them the excuse they needed to make them feel happy opposing Kerry.)</p>
<p>I believe that Clinton cannot possibly win the general election.  The Republican attack machine will have a much easier time sliming her than Obama (or Edwards).  So many people already loathe her; her &#8220;negatives&#8221; are about 40% now (this is one polling result that I have some confidence in), and (I am told) negatives are much less volatile than positives.  Last summer, I met an otherwise-reasonable woman who told me that she would never vote for Clinton, &#8220;because she didn&#8217;t divorce Bill&#8221;.  And a lot of people, most of whom won&#8217;t admit it, would not vote for any woman.</p>
<p>Obama is a brilliant and inspiring orator, very optimistic and positive, and I don&#8217;t think he will be perceived as an &#8220;Eastern elite liberal etc.&#8221; as Kerry was.  I am afraid that his major drawback is that he&#8217;s perceived as being black, albeit not with the kind of negatives that you&#8217;d get from, say, Al Sharpton (to put it mildly).  I think more people will claim to be comfortable to be voting for a black candidate than actually are.</p>
<p>A lot of these things can be influenced by advertising, organization, and endorsements; sadly, people can be influenced (the advertising industry is not crazy to spend all the money they spend).  Clinton has a lot of strengths in these areas that will help her a lot in the primaries.</p>
<p>I think that all things considered, Obama is less unelectable than Clinton, which is why I&#8217;m going to vote for him (unless something big changes in the next few weeks).</p>
<p>My prediction of the outcome, which has not changed in many months, is that Clinton will win the Democratic primary and lose the general election.</p>
<p>And what do I actually believe (as opposed to how I&#8217;m going to vote)?  I prefer Obama, although any of Obama, Clinton, or Edwards would be just fine with me as President.</p>
<p>I do not buy the argument that Clinton had <a href="http://www.slate.com/id/2182073" target="_blank">&#8220;experience&#8221;</a>.  Perhaps Biden and Dodd has experience that matters, but they&#8217;re out of the race.  Clinton was merely a kibitzer; she didn&#8217;t even have a security clearance.  And the Republicans will make great hay out of this.  (And why does she say she was named after the recently-deceased Sir Edmund Hillary, who didn&#8217;t become famous until six years after Clinton was born?  And what was going on when she made $100K in fast commodities trading?  And those are just two of the real issues, not counting all the fake ones like Whitewater.)  And they will find ways to make the point &#8220;you don&#8217;t want a woman as president&#8221;, without saying so in those words.  Attacking her will be like <a href="http://tinyurl.com/32eyql" target="_blank">shooting fish in a barrel</a>.  It&#8217;s going to be very ugly and unpleasant.</p>
<p>I hope that John McCain wins the Republican primary; he&#8217;s the least awful of them.</p>
<p>OK, now I&#8217;m on the record, here on the wonderful Internet where nothing ever goes away.  I&#8217;ve been wrong about politics many times before, and the present situation is pretty volatile and hard to predict.  (As have been the last few general elections, which were extremely close.)</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dlweinreb.wordpress.com/26/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dlweinreb.wordpress.com/26/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dlweinreb.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dlweinreb.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dlweinreb.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dlweinreb.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dlweinreb.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dlweinreb.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dlweinreb.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dlweinreb.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dlweinreb.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dlweinreb.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dlweinreb.wordpress.com&blog=2003081&post=26&subd=dlweinreb&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dlweinreb.wordpress.com/2008/01/16/how-to-decide-whom-to-vote-for-in-the-us-presidental-primary/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Notes on the book: Supercapitalism</title>
		<link>http://dlweinreb.wordpress.com/2008/01/06/25/</link>
		<comments>http://dlweinreb.wordpress.com/2008/01/06/25/#comments</comments>
		<pubDate>Sun, 06 Jan 2008 15:16:18 +0000</pubDate>
		<dc:creator>dlweinreb</dc:creator>
		
		<category><![CDATA[Book]]></category>

		<category><![CDATA[Corporations]]></category>

		<category><![CDATA[Politics]]></category>

		<guid isPermaLink="false">http://dlweinreb.wordpress.com/2008/01/06/25/</guid>
		<description><![CDATA[Supercapitalism: The Transformation of Business, Democracy, and Everyday Life, by Robert Reich, is the most interesting book on the American government and how it relates to our lives that I&#8217;ve read in a long time.
In a nutshell, the thesis is: &#8220;Capitalism has become more responsive to what we want as individual purchasers of goods [and [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.amazon.com/Supercapitalism-Transformation-Business-Democracy-Everyday/dp/0307265617/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1199632519&amp;sr=8-1" title="Supercapitalism" target="_blank">Supercapitalism: The Transformation of Business, Democracy, and Everyday Life</a>, by Robert Reich, is the most interesting book on the American government and how it relates to our lives that I&#8217;ve read in a long time.</p>
<p>In a nutshell, the thesis is: &#8220;Capitalism has become more responsive to what we want as individual purchasers of goods [and investors], but democracy has grown less responsive to what we want together as citizens.&#8221;  &#8220;Democracy means more than a process of free and fair elections.  Democracy, in my view, is a system for accomplishing what can only be achieved by citizens joining together with other citizens&#8211;to determine the rules of the game whose outcomes express the common good.&#8221;</p>
<p>He makes what I consider an extremely cogent, well-written, and persuasive argument to support this.  He explains why it happened, focusing on the history of the American economic and governmental structure starting in the post-War era (the fifties), and showing how major changes started in the Seventies and continued to the present.</p>
<p>He offers explanations for:</p>
<ul>
<li>Why CEO pay has soared into the stratosphere and what prevented it from soaring before</li>
<li> Why inflation has become less of a threat than it was three or four decades ago</li>
<li> Why antitrust laws are less important today as a means of restraining economic power than they were previously.</li>
<li> Why there are so many more corporate lobbyists and lawyers in Washington, D.C.</li>
<li> Why politicians demand that companies be &#8220;patriotic&#8221; and put America before other nations</li>
<li> Why a bigger fuss is being made over corporate philanthropy when corporations were never set up to be charitable institutions</li>
<li> How someone can fret about the decline in hourly wages and simultaneously hunt for the best deal from China or India, which is often at the expense of an American&#8217;s wages or even job.</li>
<li> How someone can lament the decline of independent retailers on Main Street while at the same time do most of their shopping at big-box retailers and online.</li>
<li> Why a person who is deeply concerned about global warming might nonetheless buy an SUV</li>
<li> Why politicians like to publically excoriate CEOs but then enact no laws making what they did illegal</li>
<li> Why the move toward improved corporate governance makes companies less likely to be socially responsible</li>
<li> Why the promise of &#8220;corporate democracy&#8221; is illusory</li>
<li> Why the corporate income tax should be abolished</li>
<li>Why companies should not be held criminally liable</li>
<li> Why shareholders should be protected from having their money used by corporations for political purposes without their consent</li>
<li> Why large companies have less economic power now than they had three decades ago</li>
<li> Why the immense increase in corporate lobbying is due to a decrease in the market power of the corporations</li>
</ul>
<p>You may be thinking about some of these points: &#8220;Oh, it&#8217;s obvious why.&#8221;  But Reich&#8217;s explanations are often not what you&#8217;d expect.</p>
<p>None of this happened because of Ronald Reagan or Margaret Thatcher; the trends were clearly under way before they came to power, and the same trends can be seen in other countries to some extent.  Neither were they caused by heroic or villainous CEOs; the changes are structural, not personal.</p>
<p>&#8220;The executives of Wal-Mart or any other large company are not brutally insensitive or ruthlessly greedy.  They are doing what they&#8217;re supposed to do, according to the current rules of the game&#8211;giving their customers good deals and thereby maximizing the returns to their investors.  Just like players in any game, they are doing whatever is necessary to win.  But just as all games require rules to define fair play, the economy relies on government to set the economic ground rules.  If government wanted to do something about the means Wal-Mart employs, it could change the current rules.  In theory, it could enact laws to make it easier for all employees to unionize, require all large companies to provide their employees with health insurance and pensions, enact zoning regulations to protect Main Street retailers from the predations of big-box retailers, and raise the minimum wage high enough to give all working people a true living wage.  All such measures would have the likely effect of causing Wal-Mart and other large corporations across the board to raise their prices and reduce returns to investors.&#8221;</p>
<p>Reich is not especially advocating that government should do these things.  His point is to show what could happen, and why things are happening the way they are.  He would like there to be more public conversation about whether or not to make these kinds of tradeoffs.  The last sentence is &#8220;The first step, which is often the hardest, is to get our thinking straight.&#8221;</p>
<p>The writing style of the book is simple and direct, and fun to read.  He has a lot of supporting facts and figures as well as good illustrative stories.</p>
<p>I believe that his overall point is extremely valid, and provides a useful framework for thinking about the vital issues of our economy and our government.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dlweinreb.wordpress.com/25/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dlweinreb.wordpress.com/25/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dlweinreb.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dlweinreb.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dlweinreb.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dlweinreb.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dlweinreb.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dlweinreb.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dlweinreb.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dlweinreb.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dlweinreb.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dlweinreb.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dlweinreb.wordpress.com&blog=2003081&post=25&subd=dlweinreb&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dlweinreb.wordpress.com/2008/01/06/25/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Technology and Business of ObjectStore</title>
		<link>http://dlweinreb.wordpress.com/2007/12/31/the-technology-and-business-of-objectstore/</link>
		<comments>http://dlweinreb.wordpress.com/2007/12/31/the-technology-and-business-of-objectstore/#comments</comments>
		<pubDate>Mon, 31 Dec 2007 21:39:31 +0000</pubDate>
		<dc:creator>dlweinreb</dc:creator>
		
		<category><![CDATA[ObjectStore]]></category>

		<guid isPermaLink="false">http://dlweinreb.wordpress.com/2007/12/31/the-technology-and-business-of-objectstore/</guid>
		<description><![CDATA[This is a follow-up to my previous article about the success of OODBMS&#8217;s, and ObjectStore in particular.  For people interested in the more technical story behind the ObjectStore object-oriented database management system, here are some stories that you might enjoy.  You&#8217;ll see why it was harder to do than we had originally anticipated. [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This is a follow-up to my previous article about the success of OODBMS&#8217;s, and ObjectStore in particular.  For people interested in the more technical story behind the ObjectStore object-oriented database management system, here are some stories that you might enjoy.  You&#8217;ll see why it was harder to do than we had originally anticipated.  There are also stories about problems with the business, with some cautionary tales that you could take into account the next time you start a company.</p>
<p>I&#8217;ve been involved with or heard about many high-tech startups.  Nearly always, the product turns out to appeal to a set of customers who aren&#8217;t the ones the founders originally had in mind. Smart founders dynamically adjust.  We found that our customers&#8217; technical requirements varied somewhat, and we had to make a lot of improvements and changes to the product to meet these new requirements.  That took a lot of engineering talent.</p>
<p>This essay includes very substantial contributions by my colleagues, which I have tried to organize into a cogent whole.  Contributors, in alphabetical order:</p>
<p>Gene Bonte: Co-founder, CFO<br />
Sam Haradhvala: Co-founder<br />
Guy Hillyer: Senior engineer<br />
Charles Lamb: Co-founder<br />
Benson Margulies: Senior engineer and head of porting (after Ed)<br />
Dave Moon: Senior engineer<br />
Jack Orenstein: Co-founder<br />
Mark Sandeen: Senior salesperson<br />
Ed Schwalenberg: Senior engineer and head of porting<br />
Dave Stryker: Co-founder, VP of Engineering</p>
<p><b>Porting Was Hard</b></p>
<p>We knew that porting ObjectStore was going to be hard.  Dave Stryker recalls: &#8220;That was the thing we talked about most during the crucial first three months when we were working out the implications of the architecture.&#8221;  However, by the time all was said and done, it turned out to be more work than we had originally anticipated.</p>
<p>We ported ObjectStore to an amazing number of architectures: many versions of Windows, many flavors of Unix, OS/2, you name it.  I can hardly remember them all.  Worse, we often had to do a port simply because a vendor produced a new C++ compiler!  So we&#8217;d have a version for Solaris on the SPARC with C++ version 4, and another for Solaris on the SPARC with C++ version 5, and so on.  We did ports to hardware that never made it big, like the NeXT, and hardware that never even reached the market. (What, you don&#8217;t remember the Canon workstation?  As Mark Sandeen, one of our best salespeople, points out: &#8220;We never should have spent the time to port to platforms with minuscule market share.&#8221;)  And every so often our sales force would book a sale on a platform that we didn&#8217;t actually support.  Quick guys, get to work!  Our porting group pulled off miracles, but all this took up a lot of engineering talent.</p>
<p>Ed Schwalenberg reminds me that &#8220;another bane of our porting existence was the set of orthogonal choices to be made in compiling a library: threads vs. non-threaded, shared vs. static libraries, 32- vs. 64-bit instructions, exceptions vs. non-exceptions, etc.  All of those were in addition to the choice of compilers.&#8221;</p>
<p>By the way, the first thing that would happen whenever we did an ObjectStore port is that we would discover bugs in the vendor&#8217;s C++ compiler.  Every single time!  As Ed Schwalenberg says: &#8220;We were the world&#8217;s C++ compiler quality assurance department for a decade.&#8221;</p>
<p>Dave Moon points out: &#8220;A lot of the early technical problems in ObjectStore were caused by our building on very immature products from other vendors.  Since they weren&#8217;t open source, we could not work around problems, and had to wait for the vendors to fix them.  This is inherent in working at the bleeding edge.&#8221;</p>
<p>Fun fact: In the early days of C++, the designers at Bell Labs came up with a specification for the first version of parameterized types.  This was of great interest to us, since we wanted to support &#8220;a set of Transistors&#8221; so that we could query over such a set, and so on.  At that time, there was only one C++ implementation, from Bell Labs, known as &#8220;cfront&#8221;, which translated C++ to C. The guys at Bell Labs apparently were not good enough compiler hackers to implement parameterized types in cfront.  So we did it for them (I believe Sam Hardhvala did the work) and gave the code back to them and the world, in an early instance of <i>de facto</i> open source collaboration.  We got a nice press release out of it.  We were very much among the world&#8217;s C++ experts at the time.</p>
<p>We also kept finding operating system bugs.  ObjectStore needed to be able to create a &#8220;cache&#8221; file, and map each page, page by page, into the appropriate virtual address, and control its access permissions, using the Unix &#8220;mmap&#8221; and &#8220;mprotect&#8221; and &#8220;munmap&#8221; system calls.  Then the application program would attempt to read or write a no-access page, or write a read-only page, causing a SIGSEGV fault.  Our SIGSEGV handler would then, analogously to a page fault handler, figure out what had occurred, and do whatever needed to be done: fetch the page from the server if necessary, map the page into address space if necessary, set the access permissions, wait for locks when necessary, and so on, finally resuming the program.  This was supposed to work in Unix, but Ed Schwalenberg says: &#8220;Recovering from a SIGSEGV did not work in any of the first dozen or so platforms we tried it on: Sun&#8217;s SunOS, IBM&#8217;s AIX, HP&#8217;s HP/UX, Digital Unix, OS/2, and the analogous thing on Win16, Win32s, and Windows NT.  Every last one of these required a conversation with the relevant kernel development team to get the operating system fixed.  Win16 and Win32s didn&#8217;t even have the concept of user-mode interception of memory faults, so we had to write kernel-level device drivers to add that capability.  Also, SIGSEGV handling did not work recursively, anything that had to work inside a SIGSEGV handler could not, itself, take a SIGSEGV (this is fixed in modern versions of Unix and Windows).&#8221;</p>
<p>Here&#8217;s a story of an operating system bug. Solaris writes out all modified pages every N seconds.  The ObjectStore &#8220;cache&#8221; file could get pretty big, and had lots of modified pages, but there was no need to write them out to the disk, since the file was discarded after a crash anyway.  We acquired a customer, Telstra in Australia, who needed real-time response: ObjectStore was invoked after a customer dialed a special phone number, to look up another phone number, and the phone switch had unforgiving time limits.  Sun suggested that we put the cache into a special &#8220;tmpfs&#8221; file system.  Files in &#8220;tmpfs&#8221; aren&#8217;t written out, because they&#8217;re known to be temporary. That made perfect sense. Unfortunately, we got rare and unrepeatable weird bugs, which finally turned out to be because the SIGSEGV/mmap/mprotect feature almost worked on &#8220;tmpfs&#8221; file systems, but not quite. We got around it somehow, but I can no longer remember how.</p>
<p>We found that Solaris was taking a very long time to execute mprotect system calls.  It turns out that the architects of Solaris had apparently assumed that there would be very few mapped regions of memory.  They had not anticipated our architecture, which mapped a huge number of pages independently.  So they were using a simple linear search. Guy Hillyer wrote an improvement to Solaris, using skip lists to make the search run in O(log n) time. The hard part was the politics getting Sun to accept our changes to Solaris!  We only did this for Solaris, which was then our primary platform.  (Maybe it should be done for Linux?)</p>
<p>When the new Windows technology (which was OS/2 at the time; IBM and Microsoft were still working together on it) came out, it was crucial for us that it be able to support memory mapping.  Dave Stryker and Tom Atwood, flew out to meet with Bill Gates in September of 1989.  Dave Stryker recalls: &#8220;We originally had a 45-minute appointment, but Gates extended the meeting to a couple of hours, and called in Dave Cutler [the architect of OS/2].  At Tom&#8217;s urging, we told Gates and Cutler everything they wanted to know about ObjectStore.  Gates was complimentary of the Object Design approach, but said, in a nice enough way, that if the Microsoft Empire ever needed such a thing, they would build it themselves.  Still, Gates told Cutler to make sure that the OS/2 equivalent to mmap was powerful enough to run ObjectStore, and there were some changes made to make it so.&#8221;  Later, this OS/2 technology turned into Windows NT.  Dave Moon adds that it turned to have a bug: it doesn&#8217;t free up disk space when it ought to.  For some reason Microsoft hasn&#8217;t fixed this, even after many years.  We found a way around it.)</p>
<p>Speaking of industry luminaries, we also met with Steve Jobs when he was at NeXT, and Jobs made a big announcement praising our technology, which resulted in a nice press release.  There was some discussion that NeXT might buy Object Design, but that never went anywhere.</p>
<p>It turned out to be hard to support customers who wanted to use the same ObjectStore database from many different client architectures.  We had to support what we called &#8220;heterogeneity&#8221;.  First there was &#8220;architecture hetero&#8221;: some machines have big-endian numbers and some have little-endian numbers, and we&#8217;d have to convert, for example.  Much worse was &#8220;compiler hetero&#8221;: different C++ compilers represented C++ objects differently in memory, due to run-time compiler &#8220;dope&#8221;, padding, and so on.  Objects were not even the same size in different compilers, which was a huge problem. We had to know every last thing about how objects were laid out, where the compiler put padding, where the compiler put &#8220;dope&#8221; information such as &#8220;vtbl pointers&#8221; and various displacement offsets, etc.   Our engineers came up with clever solutions to these problems, but it was hard and used up a lot of engineering talent.  I think if we had realized that we&#8217;d run into this problem, originally, we might have never started the company at all, thinking the technical issues too daunting.  It&#8217;s a good thing we didn&#8217;t think about it then!<br />
<b><br />
The Virtual Memory Mapping Architecture</b></p>
<p>Was the page-mapping, virtual-memory mapping architecture worth it?  Mark Sandeen says: &#8220;In competitive situations, against the other OODB companies, we sold on performance, performance, performance. Plus the fact that you got that performance by using an elegant architecture that was fundamentally different from anything our competitors had or ever would have.  We used our incredible engineering team to win the benchmark wars, and then told our customers that the reason we won the benchmarks was the 2nd generation OODB architecture.&#8221;  Sam Haradhvala, says: I still find the architecture almost as appealing as on day one of the company, and feel very lucky that we had a chance to see it realized in a product.</p>
<p>It would have been easier to port had we not gone for transparent persistence, and the goal that dereferencing a pointer was done in one instruction, exactly as in a non-persistent program.  None of our competitors did this; for C++, they used the &#8220;overloaded operator -&gt;&#8221; approach, in which dereferencing a pointer did a software operation that usually consisted of going through an indirection in an object table.  Our justification was that CAD people would never tolerate a slowdown in the time it took to redisplay a drawing.  So once the pages were faulted in, C++ operations would run at full speed. This led to all kinds of pros and cons.  Concurrency control was totally transparent and foolproof; on the other hand, it was at page granularity, causing unnecessary conflicts sometimes.  We didn&#8217;t expect this to be a problem in the classic CAD scenario since we imagined designers would usually not be working on the very same drawing at the same time.  But other scenarios did run into this sometimes.  However, difficulty of porting was our own problem, not our customers&#8217; problem, so they didn&#8217;t know or care.</p>
<p>Dave Stryker recalls some more reasons we stuck with our original idea of using the memory-mapping architecture.  &#8220;First, our competitors had staked out the strategy of overloading C++ dereferences.  Object Design came into existence after Versant (then Object Sciences) and Objectivity, and needed to be differentiated from the competition.  Second, our approach was really clever, and won many ideological converts based on cleverness alone.  We could usually count on the smartest guy in the room being an ally, because using faulting was such an impressive intellectual accomplishment.  Third, we had really smart engineers who enabled us to undertake obligations, particularly porting obligations, that with more prudence we might have avoided.  With engineers that talented, you need really disciplined, far-sighted top management, because in the short term it&#8217;s perfectly clear that engineering can work miracles.  It&#8217;s only in the longer term that the cumulative miracles sap all the capacity of engineering.&#8221;  (Mark Sandeen also remembers that we were the last of these three startups, whereas Gene Bonte says we all started at the same time and remembers a lot of details about it.)</p>
<p>Dave Stryker says: &#8220;As you say, for the largest early customers database meant concurrency, and at that point at least it was difficult to avoid concurrency conflicts among simultaneous users.  In my memory, it seemed that there were often fires burning because customers had trouble getting ObjectStore to work concurrently.  I know this got a lot better in the years after I left Object Design.&#8221;  A main technical problem is that locks were at the granularity of pages, so sometimes ObjectStore thought that there was a concurrency conflict even though there really wasn&#8217;t, and that would hold up processing until the other transaction was finished.  This is inherent in the virtual memory mapping architecture. Our competitors often pointed out this drawback.</p>
<p>He goes on: &#8220;I&#8217;ve certainly wondered if the architectural choice of page faults and native-format on-disk objects was the right one.  I was an enthusiastic booster of the page fault architecture, but it certainly made porting, multi-architecture access, schema evolution and so on much, much harder.  [Ken Rugg says that Dave Moon has made huge improvements in schema evolution in the latest releases.]  Certainly, the page fault / native object on disk architecture was instrumental in many of the CAD industry wins.&#8221;  And, &#8220;The open-source industry makes me wonder what&#8217;s the future of software products like ObjectStore.  At Multiverse where I work now, the large majority of libraries and development tools we use are open-source.  The only things we buy right now are Microsoft licenses for Windows boxes and 3D modeling tools.  The database is mySQL, and it&#8217;s going to be a fine solution for a fairly long time, because gaming isn&#8217;t hugely database intensive, even though the gaming objects would map naturally to an object database.  In many product areas today, the best and/or most successful products are open source.&#8221;  The whole concept of open source wasn&#8217;t around when we started 1988.  (Neither were Unix threads.  Nor was Windows. ObjectStore was aimed at the class of computers then known as &#8220;workstations&#8221;, primarily the Sun-3.)</p>
<p>Sam Haradhvala says: &#8220;I have often wondered like Dave and others on this thread whether the use of page faults and native on-disk representation was the correct one. It seems that it was the right choice at that time and conferred some rather unique advantages. Given the current state of technology and the hot issues of today, the limited flexibility inherent in the approach might very well dictate a different set of choices.&#8221;  But he also says: &#8220;I still find the architecture almost as appealing as on day one of the company, and feel very lucky that we had a chance to see it realized in a product.&#8221;</p>
<p>Ed Schwalenberg also points out that our architecture, by doing so many things transparently, avoided huge numbers of bugs, much as languages with automatic storage management (e.g. garbage collection) save you from bugs in storage allocation and deallocation.</p>
<p>Ken Rugg notes that we had always intended to do some kind of declarative mechanism to help support clustering and reclustering, since that&#8217;s so crucial for delivering ObjectStore&#8217;s performance advantages.  That still hasn&#8217;t been done yet, and perhaps never will be as the importance of C++ continues to decline.</p>
<p>Fun story: Ed Schwalenberg reminds me of a truly vexing case we ever ran into with the virtual-memory mapped architecture. The program went into a mysterious infinite loop.  Guy Hillyer figured out that it had a single machine instruction that had both source and destination operands in ObjectStore-managed persistent memory, in two different &#8220;versions&#8221; (when we were trying to support a very sophisticated database versioning feature).  Fetching from the source, in one version, was making the destination, in a second version, out of reach.  Retrying would fault in the destination, putting the source out of reach, and so the single instruction could never make progress.</p>
<p><b>Performance</b></p>
<p>The high performance that we designed ObjectStore for really did come out as we expected it to.  If your data had good spatial and temporal locality, and especially if concurrent access was relatively rare, it was extremely fast.</p>
<p>However, it turned out that it was not so easy to anticipate the performance that would result from using it in certain ways.  Sometimes customers would come to us literally a week before they wanted to deploy their product. They had just tried running it under heavy load, or with multiple users, for the very first time (yes, a week before they planned to deploy!), and all of a sudden ObjectStore was becoming a bottleneck.  We had some amazingly competent consultants, who could fly in and fix these problems for the customers very quickly, but not before there was some anger from the customers.  Mark Sandeen goes so far as to say that few of our customers were able to build a deployable application without help from our consultants, which limits the scalability of the business model.</p>
<p>Charles Lamb points out: &#8220;I think this happens in any database company.&#8221;  Indeed, there is a whole industry of Oracle experts; we have engaged several at my current company. Ed Schwalenberg says: &#8220;ObjectStore made it easy &#8212; too easy &#8212; for any C++ programmer to write a &#8220;database application&#8221;, while being ignorant of concepts like lock contention, database hot spots, etc.  It was folks like that, who never tested more than one user until a week before launch, who sometimes gave us a bad name.&#8221;  Everybody out there, take heed: do testing under serious performance load way, way before you&#8217;re going to release your product!</p>
<p>Sam Haradhvala, who has had extensive real-world experience with relational databases in the last few years, remembers: &#8220;ObjectStore was characterized as being like a Ferrari, which if tuned right by the experts could be made to run like one.  Tuning an application, almost as an afterthought, is a common practice even in the relational database world.  ObjectStore did make it easy for people to write database applications, without worrying about lock contentions, database hot spots, etc, but so do SQL and PL/SQL. So what was it about ObjectStore that made it a harder problem? If it had been possible in ObjectStore to use object level locks the way relational programs use row level locks, it would probably not have been as much of an issue, but this is one of those areas where the architecture puts you at a disadvantage.&#8221;</p>
<p>There were many competitive benchmarks. ComputerVision wrote an early one, aimed at determining OODBMS performance for CAD systems, and we spent a lot of time winning this.  The one that took the most effort was the OO7 benchmark, describe in my previous posting.  We spent a huge amount of time improving our performance on OO7.  From the engineering point of view, this was very helpful.  The OO7 crew at Wisconsin found many interesting performance problems that we didn&#8217;t even know about, many of which were easy to fix.  I particularly remember how much benefit we got from setting the TCP_NODELAY flag.  Meanwhile, the sales forces of every OODBMS company were using OO7 as a sales tool, each claiming to have gotten the best results!  OO7 wasn&#8217;t really designed to compare competing products, but rather to act as an X-ray to analyze the systems and illustrate how they worked, and the researchers were rather unhappy to see it used in sales situations.  Meanwhile tension developed as the benchmark was revised in order to make it a better X-ray. The problem was that each revision favored some vendors and disfavored others.  Sadly, Ken Marshall decided that the OO7 team was intentionally trying to make Object Design look bad (because one of the researchers was on the technical advisory board of one of our competitors), and Object Design pulled out of the benchmark, invoking the clause in our license saying that customers could not distribute benchmark results. As you can imagine, the Wisconsin team was pretty upset about this.  Charlie Lamb and I eventually published our own OO7 numbers, with complete instructions for anyone about the exact procedure that we had used, so that they could duplicate it.  In my opinion, we did the best overall, though not on every test, but it was never official because of Object Design&#8217;s having withdrawn from the study.</p>
<p>Gene Bonte says: &#8220;I remember Ken Marshall [the CEO] telling me that in his days at Oracle (which he left to join us), 80-90% of the significant sales depended on benchmarks. For a new market like ours, this was the same or higher.  Our salespeople and pre-sales engineers spent a lot of time trying to get customer benchmarks written so that it would favor our VMMA approach.  Our competitors did the same for their approaches. Given there were almost no concurrent user engineering applications in existence, this was always a weak to non-existent part of the benchmark and we were always strong in these situations. Thus we won most of the benchmark wars.</p>
<p>An important thing that we never got around to implementing was putting more data processing on the server side.  In formulating the architecture, I was heavily influenced by work at Xerox PARC on database systems in which the server just stored pages of data without interpreting them.  This matched ObjectStore&#8217;s needs very well; the server side wasn&#8217;t where we knew the C++ data layouts and database schema.  But sometimes this meant that you had to read a lot of data into the client side in order to search for small amounts of data in the database.  We had originally hoped that this would not be a problem on the grounds that local area networks are awfully fast. That was a good answer for many cases, but not all.  I have only recently (in my present job) worked with sophisticated Oracle experts who have shown me more about how to improve performance by processing (in PL/SQL, in their case) on the server side; I didn&#8217;t appreciate that well enough back when we designed ObjectStore.</p>
<p>Dave Stryker points out: &#8220;One thing that has made it harder for OODBMS&#8217;s is ever-growing memory and CPU power in PCs.  ObjectStore database sizes were typically just a few gigabytes or less.  Our original Sun-3 workstations had 8 Mbytes of RAM, I believe, and if you&#8217;re going to search a couple of gigabytes on an 8 Mbyte machine, you&#8217;re going to need a database system with indexes.  In contrast, today even my laptop has a 2 Gbytes of memory, and lots of workstations have 8 Gbytes or more.  It&#8217;s completely practical and common to slurp up a couple of gigs of information into memory and search it in memory on a machine like that.  So the &#8216;object database cache&#8217; of the past gets done now, most of the time, using in-memory data structures.  Even when a database is the right answer, the extra overhead of translating from an on-disk representation to an object representation happens 100 times faster on today&#8217;s CPUs than on the 50Mhz CPUs of 1990.  So the performance advantages of not translating are much smaller.&#8221;</p>
<p>Looking into the future, Dave Moon says: &#8220;The illusion of random access memory is becoming increasingly unconvincing on modern hardware.  Although dereferencing a pointer takes only one instruction, when the target of the pointer is not cached in the CPU that instruction can take as long to execute as 1000 ordinary instructions executed at peak speed.  It&#8217;s not clear that other approaches to database navigation are able to execute at peak speed, i.e. with no cache misses and no delays due to resource conflicts within the CPU, but if they were able to execute that fast, they would be able to expend hundreds of instructions to do what pointer dereferencing does and still come out equally fast, in the random access case where the target is not cached.  Thus, the advantage of ObjectStore&#8217;s architecture is being eroded by hardware evolution.  But at the same time, the advantage of C++ and other conventional programming languages is being eroded in the same way.  It is not unreasonable to predict that we will see widespread abandonment of the illusion of random access memory in the next two decades.  The IBM Cell processor used in video games is the first crack in the dam.&#8221;</p>
<p><b>Standards</b></p>
<p>Many customers wanted an industry standard, to avoid vendor lock-in.  There was never a real standard for OODBMS&#8217;s.  There was an attempted standardization effort called ODMG.  Unfortunately, it was run by the vendors, not by the customers.  So every vendor tried to adjust the standard to benefit his own technical approach and make life hard for the other company&#8217;s technical approach.  It was really not done in good faith, and we were just as bad as anyone else, perhaps even worse.  Unfortunately, there wasn&#8217;t any other OODBMS that worked the way ours did, so our customers really did have a vendor lock-in problem, which we never succeeded in addressing.</p>
<p>Ken Rugg points out that there wasn&#8217;t even a common understanding of what an object database even is! &#8220;If you looked under the covers, the actual persistence mechanisms behind Versant and ObjectStore, let alone something like Cache, are very different.  Also, these differences are much more visible to the user than differences in the engines of RDBMS products.&#8221;</p>
<p><b>Complexity</b></p>
<p>Several key customers wanted support for versioning, e.g. so a CAD system could easily keep track of earlier versions of a design.  But our highly sophisticated versioning system involved such complex semantics and such a complicated implementation that it made the whole ObjectStore client side mind-bogglingly complex.  I remember Dave Andre and I reporting to Dave Stryker that it was almost working, but it made the product unmaintainable!  We eventually had to rip it out.  It was a huge waste of engineering resources and a good lesson in the virtues of simplicity, one of the hardest and most important lessons to learn in all of software engineering.</p>
<p><b>Java, PSE Pro for Java, and Smalltalk</b></p>
<p>(Thanks to Sam Haradhvala for help with this section.)</p>
<p>When Java came to prominence, we had to figure out how to turn ObjectStore into a Java OODBMS.  Again, we went for transparency: persistent Java objects.  You program with them just the way you regularly program in Java, except that you put in transaction boundaries and so on.  Objects are persistent if they are reachable from any object designated as a persistent root object.</p>
<p>To do this, we used a novel trick: we took the Java class files, and added new JVM instructions before a read or write, to check whether the object being accessed had been read in.  If not, we&#8217;d read it in on demand.  As Sam Haradhvala points out, this can be thought of as a two-level faulting architecture.  It used object-level faulting to fault in the contents of individual Java objects, while using VMMA to fault in the underlying C++ object representation, implement scalable collections, etc. This architecture could have provided the underpinnings for object-granularity locking and increased flexibility in other areas.</p>
<p>The PSE Pro for Java product had its own storage engine which used just object-level faulting with a specialized lightweight, small footprint, storage engine.  It did atomicity and durability: committed changes happened either all-or-nothing, even in the face of system crashes.  However, it did not support concurrent access between separate Java processes. It was targeted at an entirely different market segment than the ObjectStore Java product, but had the same API, so that you could, e.g., use it as scaffolding.</p>
<p>There was even an ObjectStore Smalltalk product which used the VMMA architecture, with special hooks built into the Smalltalk ParcPlace VM, so that it could co-exist with with the Smalltalk GC.&#8221;  This was built by a team of very smart people on the West Coast.  Unfortunately, they didn&#8217;t communicate tightly with the key developers on the East Coast, and so they didn&#8217;t fit into the architecture properly.  The code became too hard to maintain, and the demand for Smalltalk turned out to be a fad in those particular years, so we discarded this.</p>
<p><b>Object-Relational Mapping</b></p>
<p>Jack Orenstein was very interested in object-relational mapping, which he describes as &#8220;my quixotic mission at Object Design&#8221;.  &#8220;The idea was to bring relational database features to ObjectStore: collections, queries over them, and mappings to and from the relational model. A relational interface to ObjectStore would have expanded the pool of ObjectStore users, and opened up the product to off-the-shelf relational tools, e.g. Crystal Reports. The opposite direction (ObjectStore programming model on top of a relational database) would have opened up the ObjectStore API to other kinds of databases. These projects were of interest to a small number of customers (e.g. USWest, Credit Suisse), but for various reasons, some due to internal company politics, they were never internally funded and supported to the point where we came out with a product.&#8221;  That was probably a mistake, perhaps a big one.</p>
<p>Objects can be stored in RDBMS&#8217;s using object-relational mapping tools.  Relational databases have become so successful in exploiting hardware, and are such a ubiquitous component of the computation infrastructure, that a vast number of applications map their objects to relational tables.  <a href="http://www.hibernate.org/" target="_blank">Hibernate </a>is a very popular system for doing this in Java.  You use Java annotation and XML configuration files to specify the mapping, which can be pretty sophisticated.  Hibernate is clever at generating efficient SQL.  It&#8217;s widely used and well-documented.  A big advantage of mapping tools is that they let you share data with other, relation-oriented applications. On the other hand, this approach is not appropriate for the kind of CAD-like applications at which ObjectStore is aimed.  Sun&#8217;s Entity Enterprise Java Beans (particularly the EJB 3.0 standard) is another mapping tool.  See <a href="http://research.sun.com/techrep/2004/smli_tr-2004-136.pdf" target="_blank">here </a>for a paper by Mick Jordan about other Java approaches to orthogonal persistence.</p>
<p>Benson Margulies says: &#8220;The idea of persistent storage of an object data model, is, in fact, ever-more-common &#8230; in the form of object-relational middleware. Relational databases have become so successful in exploiting hardware, and are such a ubiquitous feature of the computation infrastructure, that a vast number of applications map their objects to relational tables and go home for a nice lunch.  The trio of ObjectStore, Object Design, and the OODBMS concept can claim much credit for this. We wouldn&#8217;t have Hibernate, not to mention 15 incomprehensible Java standard initialisms, if not for what we did. And we had to do it. Ironically, if we had set out to build the object-relational product, I think that we would have failed. It couldn&#8217;t have been fast enough.  We identified and exploited a gap, and we had a relatively successful run in that gap.&#8221;</p>
<p><b>Query Optimization</b></p>
<p>This entire section is by Jack Orenstein, regarding the &#8220;Third Generation Database System Manifesto&#8221; claim that query optimizer&#8217;s can always do better than a programmer can do by hand.</p>
<p>The relational side of this debate relies on an assumption that applications navigate to data of interest, and then, after the query, process that data. (Or, in a few cases, process the data inside the query, e.g. simple arithmetic, simple forms of aggregation, simple updates.) But in many applications, that separation of navigation and processing is impossible or not feasible.</p>
<p>I&#8217;ve implemented polygon overlay, which I think is typical of such applications. In polygon overlay, you need to traverse linked lists of vertices and edges making up polygons. You don&#8217;t navigate to an edge and then retrieve some of its data for later processing (after the database query). Instead, the navigation and processing of the data are tightly intertwined. Yes, with enough work you might be able to separate the implementation into navigation and processing parts, express the navigation part in a query language, and then have the query optimizer generate an execution plan better than the one implicit in your original code. An approach like this would obviously be completely alien to developers.</p>
<p>But if you really did write your application this way, separating navigation from processing, then the optimizer could, in principle, come up with an execution plan that reduces the number of disk reads compared to your original implementation.</p>
<p>But only if data is clustered in a predictable way. A relational optimizer uses a cost model to estimate the number of page accesses required to implement a query using a candidate execution plan. That cost model makes assumptions about how data is organized on disk, and uses some observations of actual data (e.g. key frequency distributions). If ObjectStore data were clustered as in a relational database, then the relational argument might have some merit. The optimizer would take estimates of page reads into account, something the low-level, data structure navigating C++ code is obviously not doing. But if the ObjectStore data is clustered intelligently, then that argument falls apart. In other words, a programmer can easily beat an optimizer if the programmer is also responsible for clustering the data. (The tools for clustering data in relational systems are extremely limited.)</p>
<p><b>Multiple Applications</b></p>
<p>ObjectStore was organized around providing persistence for a particular application.  However, Ken Rugg points out that even in non-traditional market areas, some customers needed a DBMS that needs to be shared across multiple applications with different access patterns.  In such cases, it was hard to optimize one of them without hurting the other, since much of the performance depends on the way the data is clustered, and it can&#8217;t be clustered two different ways at the same time in the same database.</p>
<p>Ken says: &#8220;One area that we are working on is how to synchronize data in ObjectStore with relational data so you can &#8216;have your cake and eat it too&#8217;.  I think having multiple special purpose stores that are optimized for each consumer and synchronized and consistent with each other, (assuming you can manage them all in a reasonable way,) is better than a single &#8216;least common denominator&#8217; store that is shared by all the applications in an enterprise.  Of course doing the synchronization this isn&#8217;t an easy problem.&#8221;</p>
<p><b>Business Problems at Object Design</b></p>
<p>From time to time, I, and others, would lobby management to provide post-sales technical support, to help the customers learn how to best use ObjectStore.  The pre-sales engineers tried to do this when they could, but they were usually too busy doing their pre-sales job.  Periodically, one management regime or another would agree, and set up post-sales technical support.  Life was good.  But not for long, because management would see how valuable the customers thought post-sales technical support was, and they&#8217;d get the bright idea that we should charge for it and make it a profit center, making these guys into more consultants.  (We always had consultants who could be hired.)  Well, that was a big mistake.  Lots of customers can&#8217;t pay for consultants.  In some corporate cultures, for you to hire a consultant from the vendor tacitly implies that you are incompetent.  What Object Design needed was successful customers to use as reference accounts when we tried to sell to new customers.  Post-sales technical support was a long-term investment.  But management would often lose sight of this and go for the short-term profit.</p>
<p>Mark Sandeen says: &#8220;The fact that we needed this level of technical support resulted in an interesting situation. Every now and then we&#8217;d hire the best and the brightest engineers from our customers, leaving our customers without the talent to architect their systems appropriately.&#8221;  He and I can remember at least five of these, including several of our most awesome.</p>
<p>Our sales force faced obstacles.  One of our sales reps, Ben Bassi, told me that the moment he walked in the door and said that they were here to sell a &#8220;database&#8221;, many customers would say &#8220;We already have Oracle: go away&#8221;, without giving us a chance to explain what we were about. (But Mark Sandeen says: &#8220;I never had that happen to me personally. And I trained all the staff that worked for me to never go anywhere near a prospect that was using Oracle (or RDBMS&#8217;s in general). In the early days we followed leads from folks who had purchased C++ compilers and tools, and after we had some wins in GIS, network management, etc. We would target those folks directly.  We&#8217;d sell high performance, concurrent, persistence solutions to application developers.&#8221;</p>
<p>We even thought of trying to not even call it a database system: maybe it&#8217;s an &#8220;application data management&#8221; product, or something.  Unfortunately our marketing department never really solved this problem.  Our early salespeople were great.  Later management regimes felt that you didn&#8217;t really need salespeople who understood the product; they were too hard to find and cost too much.  Wrong.  Some of the best salespeople left when that policy started take over.</p>
<p>If you took any of our CEO&#8217;s and locked him in a room with the product, he&#8217;d not have the faintest idea how to use it.  It was a technical product aimed at programmers.  Our first CEO, Ken Marshall, was very good at delegating, and his own lack of technical background wasn&#8217;t much of a problem.  But after he left, the next CEO considered himself much more technically competent than he really was, and he made a lot of bad decisions, and he hadn&#8217;t really wanted to be CEO anyway, and he was only interested in wild ideas that would make the company grow super-fast, but those ideas never worked.  The third CEO, acquired from a merger, was a good guy but, in my opinion, totally unfamiliar with how to run a software product company, and he pretty much ignored the advice of the technical people (particularly Ken Rugg, who was CTO and VP Engineering) even though he originally solicited it.  That was when I finally threw in the towel.  Fortunately, Progress Software bought the company, and the original ObjectStore part was put under a new general manager who was apparently quite good.  So life is good again over there, and they&#8217;ve actually hired back a lot of very talented people who had left the company earlier!</p>
<p>Here&#8217;s a real life example of why it&#8217;s so hard to escape Oracle and embrace ObjectStore.  I currently work at ITA Software, Inc., where we are building a new airline reservation system.  We&#8217;re using Oracle RAC for the database system.  Our rules say that all persistent mutable information must be stored in Oracle.  Why?  Because we are using Oracle Dataguard to copy data to our disaster recovery site(s), and to copy all online data to an archive, and our operations department wants data for disaster recovery handled uniformly across the system.  We might use ObjectStore as a cache, but the place where we&#8217;d probably benefit most from a cache is a big module that&#8217;s written in Common Lisp, and there isn&#8217;t a good interface from Common Lisp to ObjectStore.  It&#8217;s often for reasons like this that it&#8217;s hard for ObjectStore to get a foothold.  However, there&#8217;s another product being developed at ITA for which ObjectStore, using its Java interface, looks like it might be a great fit.</p>
<p>Ken Rugg notes that the company took a big hit when the bubble burst in 2000.  Object Design primarily sold to high-tech companies, since the users of the product were very technical and leading-edge.  In particular, one of the major markets for ObjectStore was telecommunications companies, who were particularly hard-hit in that period.  This contributed to a decline in revenues and eventual acquisition.</p>
<p><b>Caveats and Thanks</b></p>
<p>Everything here is my own personal opinion, and should not be taken as a statement by Object Design or Progress Software!</p>
<p>Much of this is in the past tense because I&#8217;ve been gone so long, and because things have changed, but ObjectStore is still alive.</p>
<p>Thanks to all the contributors named above, particularly Benson Margulies, whose highly cogent criticism compelled me to substantially reorganize the whole essay.  I have made small edits to the contributions.  Of course, I take responsibility for all errors.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dlweinreb.wordpress.com/24/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dlweinreb.wordpress.com/24/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dlweinreb.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dlweinreb.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dlweinreb.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dlweinreb.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dlweinreb.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dlweinreb.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dlweinreb.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dlweinreb.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dlweinreb.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dlweinreb.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dlweinreb.wordpress.com&blog=2003081&post=24&subd=dlweinreb&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dlweinreb.wordpress.com/2007/12/31/the-technology-and-business-of-objectstore/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Object-Oriented Database Management Systems Succeeded</title>
		<link>http://dlweinreb.wordpress.com/2007/12/31/object-oriented-database-management-systems-succeeded/</link>
		<comments>http://dlweinreb.wordpress.com/2007/12/31/object-oriented-database-management-systems-succeeded/#comments</comments>
		<pubDate>Mon, 31 Dec 2007 21:30:24 +0000</pubDate>
		<dc:creator>dlweinreb</dc:creator>
		
		<category><![CDATA[ObjectStore]]></category>

		<guid isPermaLink="false">http://dlweinreb.wordpress.com/2007/12/31/object-oriented-database-management-systems-succeeded/</guid>
		<description><![CDATA[Object-oriented database management systems (OODBMS&#8217;s) have been harshly criticized, especially by Prof. Michael Stonebraker, who has called them a &#8220;failure&#8221;. As a co-founder of what was the leading OODBMS company, Object Design, I take issue with this judgment. As I see it, we did what we set out to do and had a lot of [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Object-oriented database management systems (OODBMS&#8217;s) have been harshly criticized, especially by Prof. Michael Stonebraker, who has called them a &#8220;failure&#8221;. As a co-founder of what was the leading OODBMS company, Object Design, I take issue with this judgment. As I see it, we did what we set out to do and had a lot of success.  As you&#8217;ll see, though, you have to distinguish between the hype, and what the product was really about.</p>
<p>There are many OODBMS products, not all alike.  Here I focus almost entirely on Object Design&#8217;s product, ObjectStore, since that&#8217;s the one I know about.  Some of what I say applies to other OODBMS products and companies, and some does not.</p>
<p>This essay includes very substantial contributions by my colleagues, which I have tried to organize into a cogent whole.  Contributors, in alphabetical order:</p>
<p>Gene Bonte: Co-founder, CFO<br />
Sam Haradhvala: Co-founder<br />
Charles Lamb: Co-founder<br />
Benson Margulies: Senior engineer and head of porting (after Ed)<br />
Dave Moon: Senior engineer<br />
Jack Orenstein: Co-founder<br />
Mark Sandeen: Senior salesperson<br />
Ed Schwalenberg: Senior engineer and head of porting<br />
Dave Stryker: Co-founder, VP of Engineering</p>
<p><b>What Is An OODBMS?</b></p>
<p>In the late 1980&#8217;s, the implementors of CAD (computer-aided design, both electrical and mechanical) and CASE (computer-aided software engineering) wanted database management systems, but found that relational database systems (RDBMS&#8217;s) did not serve their needs.  RDMS&#8217;s had been developed for business data processing.  They were sold by Oracle, Informix, IBM, and Sybase (and later Microsoft).  They had become a big business with a big market.  The CAD and CASE practitioners published papers and had conferences explaining why they needed a whole new approach to data management, based on object-oriented technology.</p>
<p>Several startup companies were formed around 1988 to meet these needs. 