Monday, 29 January 2007

I started working at TechTalk two weeks ago and one of my first tasks was – naturally – to get to know Genome. So I browsed through the tutorials and the quickstarts, and I watched the videos. Those gave me a general understanding of how to work with Genome. To get a real feel for it, I converted the data access layer of one of my pet projects to Genome. I know this pet project inside out, and it contains a couple of queries that are a bit more complex than your basis quickstart query. I felt that this was a good way to learn the details of Genome: take a project with a classic DAL that I know very well, and convert it to Genome while keeping all other aspects of the project. I struggled at first, but after a couple of days I came to grips with Genome and its query language and after that it went like a breeze.

What I like most about Genome is Query Decomposition. Suppose we have a Document entity and a Category entity. A Document can be assigned ("tagged") multiple categories, and there are many documents in each category - a classic m:p relation. In the dark ages of manual sql code, I'd have to write a stored procedure that gets all documents from the last 30 days. I'd have to write another stored procedure to get all documents in a certain category from the past 6 months. Thanks to genome, I have two select methods on my Document class for these scenarios. The first gets a set of documents from a specific time interval. The second gets a set of documents from a specific time interval that belong to a specific category. Using query composition, I can refactor these methods so that the second method calls the first method and does some more filtering on the result of the first method. Each idea is expressed only once in code. Genome takes care of executing just a single sql statement, even though I'm really calling two methods in my programming code. This is imo the real killer feature of Genome.

Posted by Dirk.

Comments are closed.