Tuesday, January 24, 2012

Degree of the leakage in leaky abstractions

We are software developers, so we very well know Joel's law of leaky abstractions.
That said: all non-trivial abstractions, to some degree, are leaky.

As a consequence it might be good to note that (according to my experiences) the deeper abstractions you create, the higher degree of leakage you get. To put it in another way, here's my funky interpretation (or rather conclusion) of Joel's law:
the degree of the leakage is directly proportional to the abstractional distance

Thursday, January 5, 2012

Fullnames in trac reports


So you are using the excellent trac tool to manage your project, right? And you'd like to see the fullname of the project participants in your reports.
Then here's a quick tip on how to do it. Basically trac as of v0.12 keeps users' profile data (fullname, email) in the session_attribute table. So you'll have to join it in your report queries.

Eg. let's see the very basic 'Active Tickets' report which comes with the base install. Modify it to look like this:

SELECT p.value AS __color__,
id AS ticket, summary, component, version, milestone, t.type AS type,
session_attribute.value as owner, status,
time AS created,
changetime AS _changetime, description AS _description,
reporter AS _reporter
FROM ticket t
LEFT JOIN session_attribute on t.owner = session_attribute.sid AND session_attribute.name='name'
LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
WHERE status <> 'closed'
ORDER BY CAST(p.value AS integer), milestone, t.type, time

Note, that for this solution to work you'll need to check if users fill their profile data correctly (in the Preferences menu).