Regarding ORMs

I cannot say that I have extensive experience with ORMs. After a recent bout or two with them, I found that there was something about them that nagged at me. Tonight, I realized what that something was. ORMs exist as a middle layer between an object oriented programming language and an entity-relational database. ORM advocates refer to what they do as solving the issue of “impedance mismatch”[1].

Herein lies the rub. ORM advocates are not solving the problem wrong, but they are solving the wrong problem altogether. They have, correctly, noted that an ER database is not an object store. However, they write the ORM as a large hack so that one can treat an ER database as an object store. They would do far better to write or use an object store–something actually designed to have a 1-1 correspondence between a “record” and an instance of a class.

There has been quite a stir lately with the rising of “NoSQL” solutions. These are, I think, little more than the old object-oriented databases coming back from the dead. While most are key-value stores and there fore not strictly speaking object-oriented, it is not hard to realize that most adapt themselves more readily to use as object stores. I think that this is where the future is heading for ORMs. In due time, the developers who today write and use ORMs will move their work over to document oriented NoSQL like databases, as these are faster (I would argue inherently, since you are not wasting time copying excess data back and forth and all about) and easier still than the ORM layer itself.

This leads to the obvious question: will a convergence of the NoSQL camp and ORMs result in the death of relational databases? I do not think so. ER databases are not bad because they are not object stores. They have their own advantages and I think they will be with us far into the future. The model has not survived forty years on account of having a poor foundation. ORMs, however, I think we can do without. Rather than solving an impedance mismatch, they are a crutch to use the wrong tool for the wrong job.



The eReader

For a belated birthday present, my lovely wife decided to get me a nook. For the past couple of weeks I have been geeking out with my new toy. I must say that I love my nook. I have only two real complaints:

  1. You cannot download ebooks from the browser. Downloading books through the store works to perfection, but when the onboard web browser is pointed at a supported format (an epub from Gutenberg, for example, or a PDF from the Internet Archive), it chokes, saying that “Downloads are not supported in this release.” I can understand Barnes & Noble’s reluctance to allow arbitrary downloads on a specialist device, but come on. I can’t download ebooks? As an aside, it would not really surprise me if this were a tactical decision to try and get you to buy books (in this case, books that don’t exist) from the store.
  2. PDF reader oddities. I cannot say how nice it is to have PDF capabilities in the first place. I download a good deal of academic papers and this makes it a lot more convenient to drop them on the reader and read them that way as opposed to soldiering through the read on a PC or printing them off. The reflow works–kind of. The problem is that words will break down to the next line mid word. There is no attempt to hyphenate properly at all. It just breaks the line. Moreover, the next lines are not joined. So, for the most part, you get a typical line oddly broken, followed by a short line. Annoying, but not unusable. Finally, in the PDF department, certain symbols do not seem to render well. I noticed this while reading a paper by Claude Shannon. A pedestrian formula (f(x) = x) came out fx = x. This got more confusing when multivariable functions were used.
  3. The touch screen is a tad less sensitive than I would have liked. Quite usable, but this still causes some annoyances.

The big thing that this has led me to try is Calibre–an open source ebook library manager, converter, and viewer. It has been pretty nifty. One of the most awesome features is the ability to provide it with an RSS feed and have it create an ebook (ePub in my case, of course). The results are beautiful. For the blogs I read that have longer articles (or more content), I simply grab the URLs from my feed reader and drop them in Calibre. With a new baby up and about, this is wonderful, as I can read while trying to walk the little munchkin to sleep.

I really think that we are seeing the beginnings of a revolution with these eInk readers that have been coming out. Unlike some of the more enthusiastic readers who have taken to them, I do not think that they will displace print entirely. They will, however, displace casual printing. Paperbacks will go electronic. If newspapers and magazines survive the internet age, they too will go eink. Enthusiastic readers will always, I think, want their favorites bound, printed, and lovingly nestled on a bookshelf.

The ereader is not a fad–but I do think it is transient as a specialist device. The biggest reason to use an ebook reader is the eink display. Mind you, ebooks have existed for years. A dedicated reader is not a prerequisite–but it does noticeably enhance the experience. This is why people want them, as opposed to reading on a smart phone or a tablet. For the cost of the nook, I could have gotten a fancy smart phone (my carrier is offering the droid for $199.99 with a 2-year plan). But the displays are not nearly so nice.

We cannot merge them with tablets yet, either. At present, the refresh rate on eink is simply too slow for general purpose computing. The lag does not seem bad compared to turning a page. It does seem bad compared to a modern monitor’s refresh. Also, I have yet to see a color eink in the wild (though I recall reading that they are coming). This is the merge point. When eink becomes colorized with a sufficient refresh rate, ereaders will merge into the touch tablet market. It only makes sense. Why have two separate devices when one can be manufactured that will do both equally well?

Ah, well. Such musings are the last you will probably hear from me in a while. My gadget money for the next little bit has most definitely been spent.