Posted on 21st October 2019
Some time ago I stumbled across Manifold an old magazine published in the 1960s out of Warwick university. It's a whimsical Mathematical magazine, now reproduced on Ian Stewart's Website. A python script later and I downloaded the image files (now repeating the exercise after I realised higher-quality scans are available from a slightly different URL base).
This left me with a large number of jpeg files, which is both annoying, and a pain to try to read. Fast-forward in time to the start of 2018. I was interested in PDF files, and got sufficiently interested to research the file format, and write a fairly serious Python module to convert PDF files into Python objects which could be browsed. I also wrote some code to produce PDF files assembled out of images: using both PNG compression, and JBIG2. For the latter I used an external converter, but for the PNG files I went so far as to implement my own (slow, but not impossibly so) implementation in Python.
Oddly, I left out the possibility to use JPEGs. This was odd, as PDF files have an extremely minimal implementation: just store, without any processing, a valid JPEG file (with headers and all). So, a solution presents itself: convert the Manifold JPEG files into a PDF. This is a reversible procedure, as it's really just bundling together the files with a small amount of extra information to form a valid PDF file.
I pull up the GitHub repository and look at the code. Initially reaction is "Wow, this is complicated." followed by "I wrote this?" followed 5 minutes later by "Ah, that's quite a nice (if I say so myself) use of an abstract base class (a use of the "Template Pattern".) 5 lines of code, and I can compress images using JPEG. I have also forgotten a lot of what I knew about software engineering (I doubt now I could structure a module as well).
It's been about 18 months since I seriously wrote code. Do I miss it? Yes, to an extent. However, life is very busy, and being a Mathematician, or being a decent software engineer, are not hobbies, and I simply don't have the time to do both at the level I'd like to. At the moment, Maths is winning.