A former colleague had a spiffy quote about good programmers and laziness, and I wish I could remember it right now.
The gist of it is almost axiomatic in the world of software development: when it comes to solving puzzles of the technical sort, a good programmer should look at the problem with a lazy eye and and a visceral aversion to repetitive tasks, in order to arrive at a solution that is efficient, and can be applied beyond the original challenge.
The simplest of examples will help to illustrate: if you’re given a list of words in a file, one per line, and asked to alphabetize them in the same format, you’re faced with a choice of methods and tools. If there are fewer than 10 words, in the absence of an automated solution you might be inclined for example to do it by hand: cutting and pasting the words into the right order yourself. The basic solutions break down quickly, however – and with a list of any more than a dozen words you find yourself turning to things like spreadsheet or database tools, where you can easily paste a word list into the program’s interface and use pre-built macros within to sort the list without (or with little) overhead. Even as a novice programmer, you might find a way to create a rudimentary program that not only sorts the words but handles the file input and output for you automatically.
The cognitive benefits of the higher-order solutions, however, not to mention the time-saving ones, are best left to a separate discussion – given that I have a more concrete puzzle in front of me today that I’m trying to work out by writing it out and chronicling my stumbling towards a more interesting, non-brute-force approach.
Warning: some degree of familiarity with the Disqus platform and its APIs will be needed to find the rest of this discussion useful.
The understanding of the problem was clouded by a compounding issue: the comment-embedding script was not being excluded from pages during the preview of unpublished posts, so comment threads were being created with post URLs that did not match the SEO-friendly URLs given to posts once they were ultimately published (and were given different titles, too, but that’s a Disqus puzzle for a different day).
We thought we had a resolution in the bag because the Disqus dashboard provides a thread migration tool that can be used to merge threads. Take each thread URL, we thought, append a comma, the new thread identifier we want to use, and upload the resulting CSV file to the migration tool. Our 600+ twinned threads would, in one fell swoop, be combined into 600+ single conversations. Just one snag – the migration tool requires a comma-separated value file – but our new disqus-identifier values, like our post ATOM ids, contain commas!
To be continued…