Book Review: The Wrong Side of Goodbye, Michael Connelly

This book is from the Harry Bosch series by Connelly and comes at a critical time. Detective Bosch has left the cold crimes unit in the LAPD, so how can the author continue to provide him with a stream of crimes to investigate? Take on some private investigator work and volunteer for the San Fernando Police Department – that’s how. This gives an interesting mix and new dilemmas – Bosch is forbidden from using police resources (such as databases) for his private work, but will he abide by the rules?

In this thriller, Bosch investigates whether a billionaire industrialist has an heir to his fortune (a private assignment) and is hot on the tracks of a serial rapist he calls ‘The Screen Cutter’ (police work). Meanwhile, his daughter Maddie has started at university, giving a glimpse of Bosch ‘the man’ as well as the detective. I loved his attempts to improve her security by putting a dog bowl (full of water) outside the kitchen door. There’s also a cameo for Bosch’s half-brother, Micky Haller, on the inheritance case.

Leave a comment

Filed under Book Review

Rambling: Bourton-on-the-Water, Cotswolds

I’d been looking forward to this ramble in the Cotswolds for a while. Though not a National Park, the Cotswolds are well known as an area with beautiful countryside and idyllic stone villages.

I chose a 10 mile circular walk from Bourton-on-the-Water, through Lower Slaughter, Upper Slaughter and Naunton. Though lacking much in the way of hills, this walk passed some lovely meadows and rivers. Naunton also has a famous dovecote, built in 1660! Although this walk was worth 34000 steps, the lack of hills meant it only accounted for 40 floors climbed.

Leave a comment

Filed under Rambling

C++ London Meetup: FFIG and Why Iterators got it Wrong

This month’s C++ London meetup features two talks – the first on C++/Python integration and the second on C++ iterators.

Foreign Function Interface Generator (FFIG) – Jonathan Coe
Jonathan presented his hobby project, FFIG, largely written on the train during his commute (!).

I want to be able to write C++ code and call it from Python without doing any extra work

He explained that existing solutions (Boost::python and SWIG) generate interfaces that bind you to a specific binary Python implementation. Whilst a work in progress, FFIG’s generated libraries are Python library independent (meaning you can compile once and call from multiple Python libraries).

FFIG generates a C-API on top of your C++ code, which eliminates any classes/structs, but provides a library readily callable from Python. It also generates a Python (or Ruby) library that layers the objects over the C-API, to restore the original interface. A key lesson learned during development was to hide any ownership concerns from the Python layer.

Why Iterators Got It Wrong РArno Sch̦dl
Arno has developed a range-like library within his firm (Think-Cell), which addresses some features of iterators perceived as ugly:

// Iterators returned by begin() and end() are asymmetrical
auto it = collection.begin(); // start of a non-empty collection
std::cout << *it; // ok - prints the first element of the collection
auto it2 = collection.end(); // end of a non-empty collection
std::cout << *it2;// error - undefined behaviour, end() returns 1 past the last element!

// Algorithms may return a valid element or a sentinel "border" indicator
std::vector<int> v1{0, 1, 2, 3, 4}, v2{};
auto result1 = std::find(std::begin(v1), std::end(v1), 2);
std::cout << *result1; // ok
auto result2 = std::find(std::begin(v2), std::end(v2), 2);
std::cout << *result2; // error - de-referencing end again

The summary was that his library distinguished between elements and borders instead of using iterators. Once rolled out through the codebase, this made the code clearer and avoided any chance of undefined behaviour. However, I think the availability of Eric Niebler’s Range library (or simple higher-order functions) make the STL so easy to use that these concerns shouldn’t put off new developers.

Leave a comment

Filed under C++, Meetup

Book Review: The Lost Fleet – Beyond the Frontier – Guardian, Jack Campbell

This book was a lucky, random find in a charity book shop. I hadn’t read anything by this author before, but the book was thoroughly enjoyable. It’s primarily a Science Fiction book – the hero, Admiral Jack Geary, guides his fleet of starships across the galaxy back to the home system, Varandal, encountering numerous enemies (some human, some alien) on the way. But he also has to overcome political challenges and man-management issues within the fleet and in the government back home.

This one is a spin-off from a series of books, so I’ve ordered the first (“Dauntless”) to fill in the background.

Four stars

1 Comment

Filed under Book Review

ACCU Meetup: Making Templates Easier, Roger Orr

Roger Orr gave this month’s ACCU presentation on Making Templates Easier in C++. He showed two techniques that people commonly use to tailor template implementations for specific types: Tag Dispatch and SFINAE (via enable_if).

With Tag Dispatch, you can switch to different implementations of a template function using traits classes based on one of the input parameter types (e.g. use std::iterator_traits to target a faster implementation for random access iterators). The downside is that you often have to duplicate code across the different implementations.

With SFINAE, you can use typedefs within a parameter type to disable particular overloads. E.g. STL containers have a ::value_type typedef, so you can use that to differentiate between collections and scalar inputs. The downside is that you sometimes have to add additional, defaulted template parameters to allow the compiler to distinguish between otherwise identical template definitions.

Roger then introduced constexpr if from C++17 and concepts from C++20.

The advantages of constexpr if are that it can be used both inside and outside templates and specialisations can be defined inline. Any code that would not compile can be put inside a constexpr if and will be discarded. This seems more straightforward than the recursive template solutions Roger showed earlier in the talk.

Concepts are intended to help define the requirements of a template in a way visible to the compiler as well as the developer. Reusing concept definitions should leave to a domain-specific language that helps within a project. Better still, use of a template parameter type that doesn’t satisfy concept requirements will generate a more helpful error message than if SFINAE were used to achieve the constraints.

The finale was an overview of the new SpaceShip operator, !

The video is now available on the SkillsMatter website.

Leave a comment

Filed under C++, Meetup, Programming

Book Review: The Escape, David Baldacci

The premise of this book is that the brilliant Robert Puller has been convicted of treason against the USA and is being held in a maximum security military prison. His brother, the gifted investigator John Puller, still believes in him, even when he escapes during a storm. John Puller works with the intrepid Veronica Knox to investigate the escape and to clear his brother’s name. They focus on the witnesses who gave testimony against Robert Puller. If he is innocent, they can’t be, so the investigators have to uncover the truth behind their lies.

This book made a good holiday read – if you have the impression that recent Baldacci books are a bit lightweight, this one won’t change your mind, but it is quite entertaining.
Three Stars

1 Comment

Filed under Book Review

Book Review: Nine Dragons, Michael Connelly

This Harry Bosch thriller starts with an investigation into the murder of a Chinese convenience store owner. It happens that this very man gave shelter to Harry in his shop during a riot, so he resolves to do everything he can to track down the culprit. During the investigation, the author answers a lingering question – how did Harry suddenly find himself looking after his teenage daughter, in later books in the series? The daughter, Madeline, was living with her mother Eleanor Wish in Hong Kong – they become an integral part of this story when a Triad gang decide to ward off Harry’s murder investigation by kidnapping Maddie.

The book has plenty of plot twists to keep the reader’s interest, but I found it too far-fetched. Identify the location of the kidnapping from a fleeting, blurred view out of the window in the ransom video? Find Maddie in the middle of Hong Kong, a city Bosch hardly knows, given just 24 hours? No problem, and why not leave a trail of destruction behind when Bosch catches a flight home with Maddie? A nice touch is when another of the author’s characters, lawyer Micky Haller, steps in to defend Bosch from any awkward charges from the Hong Kong police.

Leave a comment

Filed under Book Review