ACCU: Overload 127 (June 2015)

Overload127CoverCatching up on back issues of ACCU’s Overload magazine from June 2015, a couple of articles are worth mentioning for future reference:

  • Terse Exception Messages by Chris Oldwood.  Here,  Chris relates his experience of unnecessarily long debugging sessions due to limited error information in exception messages.  Often, this is due to laziness on the part of the programmer, sometimes because they expect to refactor a block of code soon and will come back to “do the error handling later” – then the refactoring never happens.  I see this as a false economy – even during unit testing, having proper error messages in exceptions can speed up your own debugging.
  • Get Debugging Better by Jonathan Wakely.  Here, Jonathan lists a few tips for using GDB effectively, aimed at programmers like me who typically use an IDE.

Leave a comment

Filed under Programming

Book Review: Time Out of Joint, Philip K. Dick

Time Out Of JointThis book is part of the SciFi MasterWorks series, so I had high expectations, especially as it was written by the lauded Philip K Dick. However, this book is different to others that I’ve read by him – it starts very slowly, seemingly in a normal family in a sleepy American town. Only much later does the plot encompass a more science fiction element, and a more sinister reason behind the daily puzzle that Ragle Gumm must complete is revealed.

The edition of the book that I bought has a very helpful afterword that explains how the author was trying to break away from the pulp science fiction stories into non-sci-fi novels. They bill “Time Out Of Joint” as the first of a cross-over book between the two genres. He specifically intended it to break away from the sci-fi treadmill that he was on, because he knew his current publisher would reject it in its original form!

This book is interesting for what it says about the author’s own history, but I wouldn’t recommend it for the story alone.

Three Stars

Leave a comment

Filed under Book Review

Software bug causes prisoners’ early release

BBC News reports that 3200 US prisoners were released early over a 13 year period due to a software bug.  It’s hard to fathom how this could have been released in the first place, how it remained undetected for so long, and finally why it’s taken so long to fix.

The bug miscalculated the sentence reductions prisoners in Washington state had received for good behaviour.  It was introduced in 2002 as part of an update that followed a court ruling about applying good behaviour credits.

Ok, we know that there’s always room for mis-interpretation of requirements when developing software, and every program needs some period of user acceptance testing.

The Washington Department of Corrections (DoC) added that it was made aware of the problem in 2012 when the family of one victim found out that the offender was getting out too early.

Huh? It took ten years for someone to notice? The average mis-calculation was 49 days and a maximum of 600 days – and it wasn’t noticed? What sort of testing did they do – surely some worked examples were provided?

Despite this, the faulty software was not corrected until a new IT boss for the DoC was appointed, who realised how serious the problem had become.

This is the crux of the matter – if you’re writing mission-critical software, you have to test accordingly. Here, prisoners released early may have committed further crimes – that’s a hefty penalty that could have been avoided by professional software practices: code reviews, test coverage analysis, user acceptance testing.  Surely some regression data tests existed when they were releasing the upgrade – someone must have signed off that all these differences were fine “because the rules have changed”.  Yes, but not by that much!

Mr Inslee said he had ordered the DoC to fix the software as quickly as possible.   An update that applies the correct formula for calculating sentence cuts is due to be in place by 7 January.

Let’s hope they’ve thoroughly reviewed their test coverage now and that the release goes smoothly.  Also, they should review any other software developed by the same team in that 2002 period, it’s unlikely to be an isolated mistake.

 

Leave a comment

Filed under Musing, Programming

ACCU: CVU magazine 266

Catching up on back copies of ACCU’s CVU magazine, there was plenty of good material in January 2015’s edition.
CVU Jan 2015

  • Simplicity Through Immutability – Chris Oldwood provides a worked example of the benefits of introducing an immutable type. The example is pretty simple, but experience with F# shows that this approach frequently simplifies logic (most of the time without noticeable performance penalties)
  • Delayed Copy Pattern – Vassili Kaplan compares ways to push huge objects into an STL container, with timings showing that a delayed-copy wrapper is comparable in performance to emplace-back (and the wrapper can be used for older compilers)
  • Standards Report – I was particularly taken by Mark Radford’s note on Operator Dot. At first sight, it could be dismissed as a typical C++ programmer’s wish to overload any operator available, which is currently prohibited for operator dot. However, Bjarne Stroustrup himself is named on the paper, and the motivating case is for ‘smart reference’ classes.
  • Scott Meyers Interview – more than just a subtle book plug, gives an insight into Scott’s introduction to programming and C++.

[The links to CVU articles are accessible to ACCU members only]

Leave a comment

Filed under C++, Programming

Restaurant Review: Christopher’s, Covent Garden, London

Christopher's GrillChristopher’s is billed on OpenTable as an American restaurant. Whatever image that conjures up for you (American Diner/MacDonalds?!), it’s unlikely to be the grandeur that meets you when you dine at 18 Wellington Street, Covent Garden. We had the scallops/tuna tartare for starters, both of which were excellent. We chose steaks for the main course, both were beautiful, with the Scottish fillet having the meatier taste than the New York Strip. However, it was the sweet and sour carrots that stole the show!

Five Stars

1 Comment

Filed under Restaurant Review

Book Review: The Centauri Device, M. John Harrison

The Centauri DeviceThis book is part of the Science Fiction MasterWorks series, which hints at its pedigree, although the series covers a broad range of SciFi styles. This one tells of adventures in space, where we follow the trail of John Truck and his ship the My Ella Speed.

I loved reading this book: it frequently has sentences that are so well written, you have to stop to read them again. Delicious writing to be savoured, certainly not a book that you can devour in a single sitting. I didn’t particularly warm to John Truck, he seems to be a character to whom things happen and usually go wrong, he just goes with the flow that frequently gets him into trouble. Maybe it’s his habit of getting everyone around him into trouble (or killed) that’s unsympathetic! It’s the bigger picture that’s so brilliant, the imagination and audacity of the chapters about “The Interstellar Anarchist, an Aesthetic Adventure” are epic.
Five Stars

Leave a comment

Filed under Book Review

Book Review: Reckless, Andrew Gross

Reckless by Andrew GrossThis is the second book I’ve read by Andrew Gross, the first being Judge and Jury. That book started off with children being blown up on a school bus and I found it so tasteless that I didn’t finish the book.

This book was recommended, so I gave it a good shot. It also starts with the murder of a child and her parents while her brother watches on. Later in the book, another family is kidnapped and all apparently killed, including the children.

My issue is that the plot and level of writing in the book aren’t  good enough to offset this level of violence to innocent parties, particularly children. It’s supposed to be a thriller set in the financial world, but there’s no depth to it, the author merely mentioning the names of some banks/hedge funds and a couple of exotic product types to sound informed.

TwoStars

Leave a comment

Filed under Book Review

How to filter in Swift using where

In F#, it”s common to pipeline a chain of commands together, perhaps filtering an input array before mapping with a function:

let xs = [| 1; 2; 3; 4; 5 |]
xs |> Array.filter (fun x -> x > 2) |> Array.map (fun x -> x*x)

Marcin Krzyzanowski wrote a neat post showing how Swift uses where in a number of cases to achieve similar filtering.

The fact is you can use where keyword in a case label of a switch statement, a catch clause of a do statement, or in the case condition of an if, while, guard, for-in statement, or to define type constraints

Leave a comment

Filed under Programming, Swift

ACCU: Introducing Concepts for C++

Overload 129October 2015’s edition of Overload includes an excellent article by Andrew Sutton on Concepts for C++. I first heard about Concepts at the ACCU 2013 conference and it’s exciting to hear that they have reached Technical Specification stage.

There’s no doubt in my mind that concepts will play a huge role for those involved in generic programming. In F#, we already have the ability to state constraints on template arguments e.g. to ensure that ‘T satisfies the comparison constraint:

type Container<'T when 'T : comparison>( items : 'T[] ) =
    // ...

However, I wasn’t expecting the ability to use concepts for placeholders (so that, once you’ve defined a concept, you can use it where you might have used auto to gain the benefits of type deduction without the loss of information).

Leave a comment

Filed under C++, F#, Programming

Book Review: The Fifth Witness, Michael Connelly

5th-witnessThis is another of Michael Connelly’s thrillers featuring Mickey Haller, a maverick defines lawyer. In this one, Haller defends a woman who is accused of murdering the banker who was in charge of foreclosing on her home. Not only is the court case fascinating, but the back story of Haller’s complicated personal life is just as compelling.
Five Stars

Leave a comment

Filed under Book Review