138 karma · joined March 1, 2012
They do already do this (hence the blogpost), but it's something kovarex hasn't explored before, so they're pretty new to TDD.
It's easy to gloss over the fact that for >99% of users the machine "just needs to work", and I don't think that's unreasonable. There will be a subset of kids that /do/ take an interest in this stuff, and will pick it up as the next generation of "IT magicians".
id | name | at | date_modified
1 | foo | 1 | 2018-03-21 12:00
2 | bar | 2 | 2018-03-21 12:01
3 | baz | 3 | 2018-03-21 12:02
Updating the ordering is a matter of updating a single row with it's new intended position and triggering a date_modified update. -- Move last item to top
UPDATE ordered_set SET at = 1, date_modified = NOW() WHERE id = 3;
Retrieving can easily be done using a multicolumn order by; SELECT * FROM ordered_set ORDER BY at ASC, date_modified DESC;
id | name | at | date_modified
3 | baz | 1 | 2018-03-21 12:10
1 | foo | 1 | 2018-03-21 12:00
2 | bar | 2 | 2018-03-21 12:01
If you want to explicitly get the current ordering as a sequence number some databases have
ROW_NUMBER() OVER (ORDER BY <same as above>)
as a potential solution.That said, this seems like a pretty trivial non-issue. You wouldn't want to do this on very large datasets, and updating many rows for small sets performs just fine in my experience.
I was instantly thrown back to my time watching this series and doing the exercises, which I highly recommend to anyone.
Code looks great, but this library requires some sort of frontend to be functional, not to mention that the code hasn't updated in years (probably not since Gian-Carlo's initial release).
audfprint comes with a functional commandline interface for managing such a database, at least in basic form. While I get that this sort of thing can conveniently be written in Matlab, that choice won't help with adoption of the tool. I hardly know of anyone with a Matlab runtime ready to go for random tools.
So torn between a (possibly outdated) library, and code written for an, let's say unusual, runtime, neither of these two really appeal if I wanted to build a de-duplicating audio library.