September 23, 2008 § Leave a comment
Ok, time for an update I think!
Since my last entry I have removed facades from my codebase (hurrah!) – this means that internal we now through one object around, which reduces complexity quite a bit (no more checking if something was exported to the template or not). Because I’ve been enjoying working with objects like this so much, I’m slowly changing a few subroutines that returned “derived data” (eg, a track returning artist name) to return that data through the correct object. Let’s return to the track, for a better example.
In the old code, if you needed to find the artist for a track, you’d do
$track->artist_name. This stinks though, because there’s more than just the artist name, so now we do
$track->artist->name – which is better, because it’s what we actually meant (and thought about in our heads). Furthermore, this makes it dead easy to get other artist information:
$track->artist->LoadFromID; # Load everything we can from the database about artists. my $sort_name = $track->artist->sort_name;
I’ve considered making that LoadFromID implicit (that is, if something is
undef, then the artist will load itself and try and again) – but I think I like this explicit form more. Thoughts?
In other news… I’ve introduced some slight changes to the templates, mainly exporting a few “prettifying” subroutines that map integers to names (ie, the release type and status names) – but still have some thoughts about how to make this a bit more organised.
Now, as for the future. I’m going to make a few more changes to make our system act more like a relational system should (ala the above changes), and then I can finally resume work on the editing interfaces! This work should be pretty fast – I’ve already worked out the details with the edit artist page, so I just need to extend that over different edits.
And… there’s some quite exciting news that you’ll hear about soon… but I’m not quite ready to mention it yet 🙂 Stay tuned!