I’m not a very organised person. I try to be, but it takes a lot of effort, and, being a programmer, I’m a naturally lazy sort of person. Whenever there’s a repetitive problem, I lean toward automating it in the most generally applicable way possible.
There are any number of tools for organising information, but they all tend to be either highly specific, such as a todo list, or very difficult to automatically organise and sort, such as a wiki. Ideally, I’d like a system that gives me the best of both worlds; the ability to restrict data to a specific form, but a form of my choosing. Essentially, I want a database.
However, most databases aren’t designed for quick, user-friendly, interactive use; that’s why we spend so much effort putting pretty frontends on them. Unfortunately, these facades often limit what we can do. Once we wrap our database in a GUI, we can no longer execute abitrary queries to pull out the data we want.
So what I really want is an interface that allows me to retain all the flexibility of the underlying database. In other words, I want a CLI, a REPL, an interactive prompt which I can use to query and build my database. And for this I need a query language that is both concise and succinct, something I can use to create queries in seconds, and something whose entire syntax can fit on the back of a postcard.
That rules out SQL, but luckily there’s an alternative. ISBL is short and neat, and with a few additional bits of sugar, we can build a suitable command line query language.
Let’s say I’ve built a table to hold all the tasks I have to do. In SQL, if I wanted to list all of the most important tasks, I might write something like:
select * from todo where priority > medium
So much typing! How would that same query look in ISBL?
todo : priority > medium
Better, better. Cutting out all those keywords really slimmed it down. But can we do any better? What if we allow the intepreter to guess the ending of a field or table, so we could type in “pri” instead of “priority”. So long as the prefix is unique, there should be no problem. We could type in something like:
todo : pri > med
Or even:
t : p > m
Assuming that “t”, “p” and “m” identify our table, field and value unambiguously. Combine this with a command history and perhaps even some tab-completion, and you have something that’s pretty quick to work with.
Having gotten this far, I’d really like to have some nice output to go along with my spiffy language. No result tables in ASCII art for me - I want the results of my queries to be displayed in full, graphical glory. Little check-box icons for boolean values, for instance. Markdown for my strings. Tables rendered with odd-even colours for rows. The whole shebang.
I suspect that _why’s Shoes may be just the toolkit I’m looking for in this instance, and SQLite3 can provide the database back end. I’ll have to start looking around for some decent Ruby parsers, so I can convert concise requests into longer SQL.