December 2024 archive

Review of the year: 2024

The three of us in Rhosneigr

I am now recovering from my long COVID, I can get out and about more now without getting exhausted – I even went on holiday to Rhosneigr for a week in the summer! I have fewer days feeling absolutely awful. This was in part a result of the local long COVID clinic, the instructor for the long COVID exercise classes I attended mentioned that some long COVID sufferers had issues with “mast cell activation syndrome” (MCAS) which can be addressed by dietary changes – essentially a low histamine diet. This has worked for me although I can’t drink alcohol or eat mature cheeses which has been a bit of a blow.

I have been working with the Humanitarian Data Exchange for UNOCHA for the past year which I have really enjoyed, that contract comes to an end shortly so I will be looking for freelance work. I’m also thinking more seriously about retiring. As a result of having paid work I felt able to spend freely, I bought myself a new guitar (an Epiphone Les Paul Standard gold top) and an electric bike (a Rayleigh Motus) – the electric bike has been brilliant and helped me get out and about. I think this is part of the reason I can think about retiring, other middle aged men would buy a Gibson Les Paul and a motorbike for x10 the cost of my purchases!

New guitar – Epiphone Les Paul gold top

This year I reviewed 13 books. I started the year with Her Space, Her Time by Shohini Ghose which was about a history of women in physics, generally astrophysics and cosmology in the late 19th and 20th centuries. I followed this with A Philosophy of Software Design by John Ousterhout which provided an alternative view to how best to design software. Also in this theme was Beautiful Code edited by Andy Oram & Greg Wilson, an edited volume of essays on pieces of code that their authors were particularly pleased with. In the computing theme I also read The Rust Programming Language by Steve Klabnik and Carol Nichols – I’m currently learning Rust. I actually read this book online which is a novelty for me.

My favourite book of the year was An Immense World by Ed Yong this is about animal senses, I picked it up slightly reluctantly thinking that there wasn’t much to say about the five senses and that everything was pretty well known by now. I was wrong on both accounts! I enjoy Yong’s writing, this combined with the subject matter made it my favourite.

I had a bit of an Alice Roberts binge. I read Ancestors, about burials in prehistoric Britain, a few years ago. This year I read Buried and Crypt which are partner volumes to Ancestors which cover burials in the first millennium and the first half of the second millennium respectively. Buried has a secondary theme of migration and Crypt of disease and injury. I also read Anatomical Oddities by Alice Roberts – I must admit this one didn’t really appeal to me. It is a collection of anatomical illustrations with some commentary, Roberts is a very fine illustrator but the text for the book was incoherent.

In the past I have mainly read on the history of science with most material relating to the 15th century and onwards. Roberts’ books got me interested in the earlier history of Britain. I started with Britain BC by Francis Pryor which covers Britain prior to the Roman invasion. Echolands by Duncan MacKay covers Boudica’s revolt against the Roman’s in 60-61AD, it’s a sort of history/travelogue combination which I found very engaging. Roman Britain – A New History by Guy de la Bédoyère is a beautiful, encyclopaedic coffee table book which covers the whole of the Roman occupation of Britain. I am now interested in the late Iron Age coinage in Britain.

To finish with a couple of books which didn’t follow any theme. I read Daphne Draws Data by Cole Nussbaumer Knaflic which is a book about data visualization for children – I reviewed this at the request of the author. I rather enjoyed it and hope to be able to borrow some of the illustrations for my own presentations. Sound tracks by Graeme Lawson is a history of musical instruments via archaeological artefacts. What struck me here is how little of musical instruments survives (usually only metal parts), and also how long sophisticated flutes and pipes have been in existence.

I took part in the Chester mid-summer parade, as a pirate – as I have done for the last few years – I was able to sit down a lot of the time which was a big help.

The author, in front of the new pirate ship for Chester’s mid-Summer parade

Our son is now at online school (Minerva’s Virtual Academy), he is settling in well but getting to this point was not voluntary and was traumatic.

We’re looking forward to a new year of improving health, semi-retirement and lower stress education!

Book review: The Rust Programming Language by Steve Klabnik and Carol Nichols

My next review is a small departure, it is for The Rust Programming Language by Steve Klabnik and Carol Nichols but rather than buy the physical book I read this interactive version, which has quizzes and embedded, runnable code.

The Rust programming language is the target for my next Rosetta Stone blog post which identifies all the tooling for a language. For Rust these tools (the compiler, formatter, linter, package management and automated documentation) are pretty much all “built-in” so my job will be easy. The challenge in this case has been learning the language since I try to write a little code for the Rosetta Stone posts to demonstrate what I’ve learned.

Rust is a relatively new language, very highly regarded amongst developers and one of only two approved for developing Linux. Its focus is on “safety” and speed. It has been used to make new, highly performant tools for the Python ecosystem, like ruff and uv, which is how I came to know of it.

For a Python programmer Rust does not look alien in the way that Haskell and Lisp do; admittedly it uses curly braces for scoping, is strongly-typed and supports pointers and references which are not features of Python but are common in other languages.

To me it feels like C but with some object-oriented features; the authors talk explicitly about it having features of functional languages including use of the Option value which contains something or nothing, the compiler enforces the handling of nothing. I think I might start using this more explicitly in Python which allows type-hinting to indicate an Option-like value. The other explicitly referenced functional feature is the use of closures, in Python closures are functions defined within functions or anonymous / lambda functions whilst in Rust they seem to be closer to functions passed as arguments to other functions.

Rust makes what seems an odd distinction between functions and macros in its standard library. Macros are identified with an exclamation mark, for example println! As I understand this is because a macro is implemented using code generation at runtime which allows the developer to supply, for example, a variable number of arguments to println! which would not be possible for a function println. Python doesn’t make this distinction and is very permissive in the arguments that a function can take, allowing both position and keyword arguments of variable number.

I was struck by the way that different languages use the same word for different things. For example in Rust a struct is both a data container but can also carry methods in the way that “classes” in other languages do. In Python an enum is a closed list of values but in Rust those values can have user-defined associated values so that an enum for IP address protocols can contain V4 and V6 (as it would in Python) but in addition it can hold an actual IP address associated with each entry in the enumeration.

My understanding is that Rust is considered an object-oriented language by some but not all. In practical terms the only object-oriented feature missing is inheritance although this can be approximated by the use of generics and traits.

Since I have scarcely used pointers and references in 40 years of programming I found these concepts a bit challenging but I have made progress in my understanding through reading this book. Excited by this new found understanding I was then confused by Rust’s ownership model! Ownership and borrowing are the big, unique conceptual features of Rust. The aim of ownership is to rigorously ensure that code is safe – no writing past the end of arrays, or dereferencing null points. It also means that the performance hit of a garbage collector is not required, this task is pretty much entirely handled at compile time by the borrow checker. The strong ownership model makes concurrent programming easier too.

In trying to understand ownership and borrowing I found some useful tools, the best entry point was the BORIS tool by Christian Schott which lists other visualization tools including the Aquascope tool used in this book. I found the first such tool in RustViz which is used in teaching, it needs the user to put annotations into the code rather than working out the annotations itself. I also read this article by Chris Morgan.

As language books go, this one is pretty readable, and I found the built-in quizzes handy, if only to illustrate my ignorance particularly of the ownership and borrowing model. I think for my next technical book I might read Category Theory for Programmers by Bartosz Milewski. I have felt when applying type-hints to Python, and learning Rust and Haskell that I was missing out by not understanding at least the basics of category theory.

I enjoyed this book and the format worked pretty well for me, although I need to find a way of reading online content like this in more comfort. I’m keen to give Rust a go now!