Regarding ORMs

August 10th, 2010

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.

References

  1. http://www.agiledata.org/essays/impedanceMismatch.html

Post to Twitter Tweet This Post Post to Delicious Delicious Post to Digg Digg This Post Post to Facebook Facebook Post to Reddit Reddit Post to StumbleUpon Stumble This Post

The eReader

August 7th, 2010

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.

Post to Twitter Tweet This Post Post to Delicious Delicious Post to Digg Digg This Post Post to Facebook Facebook Post to Reddit Reddit Post to StumbleUpon Stumble This Post

Casual Literate Programming

June 28th, 2010

In trying to really “get” literate programming, I have been using it for a number of my smaller, almost toy, projects. Little scripts, utilities, that sort of thing. Those chunks of code that programmers and computer enthusiasts write, not because they must or for a paycheck, not even to write that big application that’s missing from their toolboxes–but just to make those stupid little problems in life go away.

The results have been encouraging.

Overall, it does not seem to take me much, if any, longer to write the little script. Usually, the information is nothing new–it is the requirements and research that I would have had to do anyway to build the tool in the first place. At least with this method, that information is not lost as it is stored right alongside the script itself.

It is true that this does not produce the large volumes that literate programming is semi-famous for, including Knuth’s own Literate Programming, but it does fulfill the fundamental tenet of literate programming, namely that programs should be written for other human beings. This is particularly pertinent in scripting, because, it seems, that scripts are particularly prone to the read-only syndrome. I noticed this myself just recently when I was cleaning out my ~/scripts directory (superseded by ~/src and ~/bin–one of the reasons for the spring cleaning).

Does anyone else have any thoughts on literate programming for little one-offs?

Post to Twitter Tweet This Post Post to Delicious Delicious Post to Digg Digg This Post Post to Facebook Facebook Post to Reddit Reddit Post to StumbleUpon Stumble This Post

Asciidoc backend for Noweb

June 23rd, 2010

I’ve been toying with using noweb for some miscellaneous coding projects of late. I personally prefer Asciidoc over other formats supported as backends for noweb, including LaTeX and HTML, so I wrote a backend for it. A copy of my patchset can be found at:

http://www.mad-computer-scientist.com/files/toasciidoc.patch

The archive contains patches against the 2.11b release (current, as of this writing). Drop me a line if you have any questions or comments.

Post to Twitter Tweet This Post Post to Delicious Delicious Post to Digg Digg This Post Post to Facebook Facebook Post to Reddit Reddit Post to StumbleUpon Stumble This Post

Compiling a KDE 3.5 app on Ubuntu 10.04

June 15th, 2010

I was trying to compile an old KDE 3.5 application this weekend because no port to KDE 4 has yet been made. Judging by the activity on the site, it is doubtful that it ever will be. For the curious, I was trying to get SchafKopf [1] up and running. I am running Ubuntu 10.04 (Lucid) which has long since ditched the KDE 3.x line for the shiny 4.x line.

While some of the KDE 3 libraries still ship, some key ones for this particular application were missing. Namely, libkdegames. The solution turned out to be the KDE/Trinity project [2]. This project attempts to continue development and maintenance on the 3.x line.

As a sidenote, this is what is so beautiful about open source software. The vendor threw out a line that was beloved of some and replaced it with something they did not like so well. Rather than being stuck, they can maintain the software themselves.

Back to the problem. All that I needed to do was install the libkdegames-kde3-dev package and run:

% ./configure --without-arts --includedir=/opt/kde3/include/kde
% make
% sudo make install

and everything was cool. --without-arts may or may not have been necessary after installing the trinity libraries. It was earlier. /opt/kde3/include/kde is where the includes were placed, instead of the standard path.

Have fun.

Post to Twitter Tweet This Post Post to Delicious Delicious Post to Digg Digg This Post Post to Facebook Facebook Post to Reddit Reddit Post to StumbleUpon Stumble This Post

Of Grants and Taxes

May 6th, 2010

Academic literature is expensive.

Now, a great many academians post their work for free, on their websites for their own reasons. In most cases, it is because publication is largely a publicity act. Others want to see their work spread. Others think information should be free. Whatever their reasons, some do.

Some don’t. They largely do not see the point.

Whatever the acts of the individuals, academic literature is expensive in its published form. If you go to ScienceDirect, the price for a single article or book is steep–over $30. You have to dig for the prices too: http://www.info.sciencedirect.com/buying/individual_article_purchase_options/ppv/

Journal prices are similarly expensive.

There is just one catch: almost all academic research is funded by government grants. Why, as a tax payer, should I have to pay over $30 to access a paper that I paid for in the first place? Private researchers and private journals have every right to control the prices of their wares–but the academic world has no business charging for anything more than bandwidth (pennies per download) to an American citizen when working on a United States Federal grant.

Of course, none of this would even be a theoretical concern if we respected the Constitution’s limitations and left the funding of research “to the states and to the People.”

Post to Twitter Tweet This Post Post to Delicious Delicious Post to Digg Digg This Post Post to Facebook Facebook Post to Reddit Reddit Post to StumbleUpon Stumble This Post

ebooking

May 5th, 2010

Over the weekend, I tried to read PG’s Paradise Lost etext, in mobi format, on my work Blackberry. I find something interesting and try to add an annotation–a note right? I read a book and I can take notes. Sounds simple enough. The field for the note is ridiculously short, to the point of being almost worthless. Let me get this straight: I can’t take arbitrary length notes while reading a mobi? WHAT IN THE HECK?

Post to Twitter Tweet This Post Post to Delicious Delicious Post to Digg Digg This Post Post to Facebook Facebook Post to Reddit Reddit Post to StumbleUpon Stumble This Post

Living with Info

April 13th, 2010

Since my previous rant on Info
files
, I have
had yet another run in with GNU’s documentation system. This has
brought a couple of things to the forefront. First, that I have
some more random ramblings on the subject of GNU. Secondly, that
this time I couldn’t take it, and decided to find some things
that would make life livable with Info.

In my googlings, I found a discussion of
Info
in which the
Info-lovers seemed to be at a genuine loss to understand why the
rest of us despise Info with a passion. Almost without fail, you
find that the Info-apologist, at some point, says that they love
being able to navigate Info from Emacs. There is Info’s sweet
spot. If you are one of those poor souls who lives in Emacs (I
look up man and info alike from the commandline), Info will seem
pretty sweet. Bindings similar to the main editor (less bends
more towards the vi side of things), and the documentation
browser embedded in the editor. Not half bad. They also maintain
that the hyperlinks are an awesome part of it. As if text
browsers don’t exist or haven’t been fully integrated into Emacs
(everything is in Emacs, except a good text editor).

Fortuantely, there is hope. There are ways to avoid interacting
with info proper. The first option, on Server
Fault
,
is to convert them to plain text with info itself. Just run:

info --subnodes --output=output.txt infopage

And all of the nodes on the info page will be dumped into the
given output file. This can then be viewed with the pager of your
choice.

Another option, posited by the denizens of
reddit
is an application named
pinfo. It is a
nice little info page browser with lynx/vi/less like bindings.

I have tried both, but I tend to find myself dumping Info files
out to text more often and viewing them with less. It is much
more manly.

Post to Twitter Tweet This Post Post to Delicious Delicious Post to Digg Digg This Post Post to Facebook Facebook Post to Reddit Reddit Post to StumbleUpon Stumble This Post

Noweb & Vim

April 1st, 2010

I just posted my first vim script, a syntax file, to vim.org: http://vim.sourceforge.net/scripts/script.php?script_id=3038

It is a little mode, of sorts, for working with Noweb files in vim. Basically, it uses one syntax for the doc chunks, another for code chunks, and autofolds the code chunks (off by default). Folding just feels natural with code chunks. I am using it now with one of my tinkering projects and, despite its minimal size, a mere 35 lines, it is really nice.

Of course, it would be a little odd to write some code to facilitate literal programming in a nonliteral style. I will be posting the full literate version here, shortly.

Post to Twitter Tweet This Post Post to Delicious Delicious Post to Digg Digg This Post Post to Facebook Facebook Post to Reddit Reddit Post to StumbleUpon Stumble This Post

et tu, WordPress?

March 23rd, 2010

I’ve been playing with some code to handle WordPress exports (I’m planning to consolidate and retool this site–I don’t like the schizophrenic 2 sites within a site mentality that it has right now) and one thing is clear: WordPress has some issues. A nice platform, by and large, but the export, running the latest stable version, produces invalid XML. The database coalition is UTF-8 and there are characters in the dump that are valid UTF-8, but invalid XML. Moreover, the URLs are not properly escaped, so the anchors in URLs make the parser throw invalid charref errors.

Most of the offending posts are, of course, spam from before I got some good captcha software running (thanks, Zach). These are duly marked as such in the markup and would, of course, have been excluded from any of the later processing–except that I am having to spend time hacking around the broken markup just to get to that point.

Oh, well. Such is life.

Post to Twitter Tweet This Post Post to Delicious Delicious Post to Digg Digg This Post Post to Facebook Facebook Post to Reddit Reddit Post to StumbleUpon Stumble This Post