Journal Articles

CVu Journal Vol 31, #3 - July 2019
Browse in : All > Journals > CVu > 313 (9)

Note: when you create a new publication type, the articles module will automatically use the templates user-display-[publicationtype].xt and user-summary-[publicationtype].xt. If those templates do not exist when you try to preview or display a new article, you'll get this warning :-) Please place your own templates in themes/yourtheme/modules/articles . The templates will get the extension .xt there.

Title: Reviews

Author: Bob Schmidt

Date: 02 July 2019 00:42:59 +01:00 or Tue, 02 July 2019 00:42:59 +01:00

Summary: The latest roundup of reviews.

Body: 

We are always happy to receive reviews of anything that may be of use, or of interest, to software developers. The emphasis will tend to be on technical books, but we are also interested in less-technical works – for example, the humanities or fiction – and in media other than traditional print books.

Do you know of something you think deserves – or does not deserve – a wider audience? Share it here. We're keen to highlight differing opinions on the same work, so if you disagree with a review here do send in your own! Contact Ian Bruntlett at reviews@accu.org.

Exploring Raspberry Pi: Interfacing to the Real World with Embedded Linux

By Derek Molloy, published by Wiley (2106),ISBN: 978-1-119-18868-1

Reviewed by Daniel James

This book – with a glowing endorsement by Eben Upton on the front cover – promises a lot. Can it deliver?

When we hear ‘Embedded Linux’ we normally think of some sort of appliance – a router, maybe – that runs some custom application on a trimmed-down Linux distro from ROM. The Raspberry Pi is most emphatically not an embedded system, in that sense, but rather a fully-featured computer running (typically, but not necessarily) a full desktop Linux distro. The book’s sub-title therefore led me, initially, to fear the worst.

The book’s 700-odd pages are divided between sixteen chapters organized in three sections. Each chapter is well-organized, in most cases beginning with a preamble and a list of any hardware parts required to complete any exercises in the chapter, and ending with a summary and in some cases a ‘Further Reading’ section listing both online and hard-copy resources. Photographs, diagrams, and code samples are plentiful, and are used effectively.

The first section is entitled ‘Raspberry Pi Basics’. The first couple of chapters describe the basic hardware and software environment provided by a Raspberry Pi running the default Raspbian (Debian-derived) Linux distribution. The availability of other Linux and non-Linux operating software is mentioned in passing, but the emphasis is (quite rightly, in my view) on Raspbian. OS installation and set-up are discussed, as is headless use (over a network or a serial connection). Chapters 2 and 3 contain as good a short introduction to using the Linux command line as I can remember seeing, together with a quick introduction to git (which is important as many Raspberry Pi code samples and Open Source libraries are available from github).

Chapter 4 contains a good tutorial on the theory of digital electronics and a description of the components one may encounter and how to use them. Chapter 5 ends the first section of the book with an introduction to programming on the Pi. The efficiency of various languages is compared, and examples of code to drive a simple flashing LED circuit are given in a variety of languages from bash to C++, passing through the inevitable Python as well as Java, Javascript, and Lua. None of the languages is covered in great detail, but there is enough to give a flavour, and although the author confusingly refers to ‘C/C++’ as though that were a single language he does describe them separately and give both a C example and a separate Object-Oriented example using C++ classes.

The second section of the book is entitled ‘Interfacing, Controlling, and Communicating’. Chapter 8 describes the Pi’s GPIO bus and gives examples of input and output using the /sys filesystem, using memory-mapped i/o via /dev/mem, and using the WiringPi C library. The examples here all use the Linux command line or programs in C or C++.

Chapter 7 describes development of Pi software on another (Linux) computer. This leads to a discussion of cross-compilation and remote debugging using Eclipse, and finishes with cross-compiling a custom Linux kernel for the Pi.

The next three chapters deal with communication between the Raspberry Pi and other devices – such as sensors, motors, and displays – using the Pi’s GPIO pins as serial, I2C, and SPI buses. The techniques are all well explained and example code (most of it in ‘C++ as a better C’) is given. The last chapter of the second section discusses using an Arduino computer as a slave to the Pi, communicating over I2C – because there are some things a dedicated microcontroller can do better than a general-purpose computer running a multi-tasking OS!

The final section of the book is entitled ‘Advanced Interfacing and Interaction’. Chapter 12 describes web client and server software on the Pi and using the Pi as an IoT device. Chapter 13 adds handling of wireless interfaces and interfacing to XBee devices, as well as Bluetooth and NFC communications. Chapter 14 discusses programming a GUI on the Pi itself, using Qt, and chapter 15 adds images, sound, and video to this and discusses the Raspberry Pi camera interface.

Finally Chapter 16 discusses Linux kernel programming and Pi-specific device drivers written as loadable kernel modules.

That’s a lot of material! If the coverage of some of it is a little light that’s understandable. Some authors might have not have chosen to include some of the more advanced and less Raspberry-Pi-specific topics, but I would say that one of the strengths of this book is the breadth of its coverage. The reader may need to look further to learn how to use some of the techniques presented to best effect, but the coverage does at least illustrate what can be done and suggest avenues for further reading. It may not contain all the answers, but it does at least help in concocting good internet search terms!

Two things niggled. One is to do with software, and concerns the author’s tendency to blur the distinction between C and C++. One might also hope that a book published in 2016 and claiming to use C++11 would use more modern features and idioms.

The other niggle concerns hardware. Everything else I’ve read that describes controlling an LED with a Raspberry Pi uses a simple circuit in which a current-limiting resistor and an LED are connected in series between one of the Pi’s GPIO pins and GND, but here it is stated that the Pi’s GPIO lines can provide only 2-3mA of current – not enough to drive an LED – and will be damaged by any attempt to draw more. The author suggests using a transistor to switch a circuit drawing current from another source instead – and, indeed, all the examples in the book that use LEDs driven by the Pi employ such a technique. That surprised me – were all those other books, articles, and websites wrong? Was I in danger of blowing up my Pi?

No. The book is misleading, here, because it perpetuates an early misconception that seems to arise from the fact that the original Raspberry Pi had only about 50mA of power available in total for its 17 GPIO pins, and so just under 3mA per pin. Later Raspberry Pi models – including those current when the book was published – have more power available, and the actual limit per GPIO pin is 16mA (a limitation of the Broadcom BCM2835 system-on-a-chip family, versions of which are used by all models of Raspberry Pi). 16mA is plenty to drive typical LED with (say) a 260 Ohm current limiting resistor in series. I’ve had 26 LEDs running simultaneously using all 26 GPIO pins of a Raspberry Pi Zero-W in this way.

There is some discussion of this on the book’s support website. It seems that the author was unable to find authoritative data on the BCM2835 when writing the book, and based his advice on the total current limit for the original Pi. This doesn’t make the book wrong; it just means that some of the example circuits in the book could have been made simpler. The use of a transistor to switch a circuit is a valid technique, and is necessary for circuits whose current requirements really do exceed the capability of the GPIO bus.

I found this an interesting and surprisingly exhaustive book that does, indeed, live up to its hype. As a programmer I found it to be a good guide to the Raspberry Pi, its capabilities, and all the things you can do with it – as well as a useful course in digital electronics. The old C++ style in the examples was disappointing, but this book is more about hardware than software, so perhaps I’m being unfairly critical in this regard.

For experienced programmers who are looking specifically for information on Raspberry Pi hardware and interfacing, and who will not be led astray by any deficiencies in the sample code, I’d give this a ‘Highly Recommended’ rating, for everyone else I’d give it ‘Recommended’.

Language Implementation Patterns

By Terence Parr, published by Pragmatic Bookshelf (2009), ISBN: 978-1-93435-645-6

Reviewed by Paul Floyd

This was my summer holiday reading. I should perhaps have taken a slightly longer book, but I wanted to keep the weight down.

The author of this book is also the creator of ANTLR (Another Tool for Language Recognition, something that I’d always imagined be some sort of backronym from LR, but no, ANTLR is LL – LR and LL being parser types). Parr clearly knows his stuff, and does a good job of explaining the processes. The explanations are clear and well laid out. The sample code is mostly in Java, but it is simple enough that anyone with a grounding in C or C++ should be able to follow it.

The chapters are mostly split into two parts. First is an overall introduction to the theory being covered. This then leads to ‘Patterns’, which cover the specifics and example implementations in more details. Often design choices are presented along with their advantages and disadvantages. The book progresses from basic parsing to template-driven generators in a steady fashion. Perhaps this comes from the study of grammars, but the explanations all seemed to progress without there ever being a need to refer to matter covered later in the book.

I only have a fairly small amount of experience with parsers and lexers (mainly with flex and bison), so the parts that were the most interesting to me were the extras that such old-school tools don’t offer (that I know of) like data models and rule rewriting.

Finally, I enjoyed this book so much that on return from my holidays I bought The Definitive ANTLR 4 Reference by the same author (watch this space, but don’t hold your breath).

Recommended.

Optimized C++

By Kurt Guntheroth, published by O’Reilly (2016), ISBN: 978-1-491-92206-4

Reviewed by Paul Floyd

I’ve always been an advocate of avoiding gratuitous premature pessimization (is it ever possible to mention optimization without quoting or paraphrasing Knuth/Hoare?). So this book was pretty much up my street. It’s well written, and I liked the fact that it uses C++11 – there’s no point in pandering to the laggards that are stuck in the last century. There are 13 chapters that cover an introduction, hardware and timing, algorithmic optimization, low level optimizations (code changes, memory use, I/O and threads) and memory management.

I enjoyed the coverage of timing, and in particular the limitations and evolution of the timing features available on x86 based systems. Another high point was the debunking of some myths like std::vector always being significantly faster than std::list, along with fairly wide ranging tests. However, this leads me to one of the weaknesses. Pretty much all of the testing was done with one compiler (MS Visual Studio) and platform. So without a wider range of platforms and compilers I found myself taking the results with a pinch of salt.

There were three things that struck me as missing. In Chapter 4, there is a lengthy discourse on optimizing a function that strips control characters from a string. One of the techniques used is pass by reference. This results in an 8% performance degradation, which is not explained in any way. I would expect a book like this to get to the bottom of such as issue. The second thing that is missing is detailed coverage of profiling tools. The author seems to prefer instrumenting code with timer calls, which is good enough, but I thought that there should have been some explanation of the different kinds of profilers and some example usage. Lastly, a lot is said about std::string and its performance not being great. However, there is no mention of the Short String Optimization (SSO). I was expecting some mention of it and perhaps characterizing the performance ‘knee’ is string lengths exceed the SSO threshold.

In summary I enjoyed reading this book and learned a few things but there were a few annoying nits.

Recommended.

From Mathematics To Generic Programming

By Alexander Stepanov and Daniel Rose, published by Addison-Wesley (2014), ISBN: 0-321-94204-3

Reviewed by Paul Floyd

This is a kind of follow-on from Elements of Programming, though this book has much more of a cultural feel to it. It’s a kind of History of Art for Mathematics, Algorithms and Programming. The early chapters cover mathematics from the Ancient Greeks to the Middle Ages. As well as descriptions and examples of the mathematical concepts being introduced, there are short profiles of the men and women that discovered them. Some of these are fascinating – I didn’t realise that Lagrange was born in Italy, I knew little of Peano and I’d never heard of Simon Stevin.

The maths is mixed with examples in C++, more numerical earlier in the book and then more abstract later as the notions of group theory are introduced. One theme running through the book is the Greatest Common Divisor (GCD) which takes us from Euclid to Chapter 13 which covers cryptology. I found the explanations to be clear and in some cases (like cyclic groups) I understood properly for the first time in my life. This isn’t a book to learn any programming skills from, but it does show that some of the ideas that underlie C++ and programming in general go back over thousands of years.

I enjoyed reading this book so much that I’m tempted to search for a more compendious book on the history of mathematics.

Highly recommended.

Improving Software Development Productivity

By Randall W. Jensen, published by: Prentice Hall (2015), ISBN: 978-0-13-356267-5

Reviewed by Paul Floyd

I’ve read a lot of books, and I usually look in the bibliography to see if there is anything there that looks interesting. Usually when it comes to bibliographic references, they are of the works of Barry Boehm and Capers Jones. I don’t remember seeing any references to Randall Jensen, which I thought was perhaps a bad sign. Well, this initial slight prejudice turned out to be unfounded.

It seems that to be an authority in software productivity you either need to have developed a model or have some sort of methodology. In the case of Boehm, it is the Cocomo model, in the case of Jones it is the function points methodology. In Randall’s case, it’s two models, Sage and Seer, which seem reasonably similar to Cocomo. Whilst the bulk of the book does go into the application of these models, there is also plenty of discussion of the rationale behind the factors that are employed. For me the high-points of the book are in the earlier chapters where Jensen covers the fundamental problems in software development, some of the history of techniques and that have succeeded and failed. The section on measurement dysfunction definitely struck a chord with me.

On the negative side, there were a few oddities. Jensen clearly has a bit of a bee in his bonnet about the Western education system that favours individual competitiveness rather then teaching group work which would be more suited to most people’s working lives. He also says a fair bit about the working environment, eschewing cubicles and proselytising open-space. I’ve always considered DeMarco and Lister’s Peopleware to be the reference on this matter, and they advocate private offices.

Recommended.

Foundations of Software and System Performance Engineering

By Andre Bondi, published by: Addison-Wesley (2015), ISBN: 0-3183382-1

Reviewed by Paul Floyd

Maybe the problem that I had with this book is that I was expecting something else, something on the same lines as Systems Performance by Brendan Gregg (which has much detail on actual measurement of performance). Bondi covers a great deal of the theory around performance engineering. There’s a whole chapter that is devoted to queuing theory. Then there is much on planning and requirements and how to interpret and present measurements.

I did quite enjoy the chapter on ‘Scalability and Performance’ (which has an amusing example of the cloakrooms at the New York Met and Modern Art museums and the Louvre). The following chapter on pitfalls in measurement contained some sound practical advice.

The parts of the book that are ‘down to the metal’ are a brief mention of ‘ps’ on Unix for memory measurement and another of ‘perfmon’ on Windows for network measurement. That’s too abstract for me – I guess that you need to be working on a large system with hundreds or more staff and a team dedicated the system performance in order to be able to benefit from a book like this.

Not recommended.

12 Essential Skills for Software Architects

By Dave Hendrickson, published by: Addison-Wesley (2011), ISBN: 0-321-71729-5

Reviewed by Paul Floyd

The ‘essential skills’ that are covered in this book are soft skills: interpersonal, finances and politics. As such the material is fairly subjective, which makes it difficult to judge whether the advice is good or bad. It also means that the advice can be quite vague and general. Clearly, however, the perspective is that of someone in tune with upper management. Whilst there are sections on saying ‘no’ and handling conflict, the overall tone is more ‘alignment of vision’.

Based on my experience, I see that there is a lot of truth in what Hendricksen says. Early on he describes the ‘technical ceiling’, basically a barrier beyond which it is difficult for careers to progress without developing these soft skills. I also see that it’s a difficult act to balance. When it comes ‘relationships over correctness’, it’s a fine line to tread between being sycophantic, getting the balance right and getting into conflict.

I would have liked fewer buzzwords, and I thought that the diagrams looked a bit amateurish – perhaps the services of a graphic artist could have been called upon?

So in summary, a decent overview of business relationships within software development.

12 More Essential Skills for Software Architects

By Dave Hendrickson, published by Addison-Wesley (2015), ISBN: -321-90947-X

Reviewed by Paul Floyd

In this follow-on book to 12 Essential Skills for Software Architects, we get coverage of the technical skills that mirror the soft skills. There is some overlap with the first book, and some of the chapters here seemed fairly ‘soft’ to me: partnership, governance, roadmapping and entrepreneurial execution. It wasn’t particularly clear to me how ‘software architecture’ differs from general software management and development, not that the title matters much.

For a book covering technical skills, I did expect some more concrete examples, perhaps some real world case studies would have helped. As it was, I was left wondering whether I was just reading sensible sounding platitudes, or whether there were any success/disaster stories when the advice was followed/ignored.

One chapter seemed a little odd to me, chapter 6 on ‘Platforms’. This more or less assumes that you work on a big system that will evolve to become platforms. Perhaps I haven’t worked on enough (or indeed any) many major governmental IT projects, but my experience is that after a couple of decades, code tends to evolve into multi-million line monoliths.

As with the previous book, the diagrams look a bit cheesy and don’t add much. For instance, is there really any reason why ‘Relevance’, ‘Excellence’ and ‘Currency’ should form a triangle?

Notes: 

More fields may be available via dynamicdata ..