REVIEW - Hands-On Functional Programming with C++ - An effective guide to writing accelerated functional code using C++17 and C++20


Title:

Hands-On Functional Programming with C++

An effective guide to writing accelerated functional code using C++17 and C++20

Author:

Alexandru Bolboacă

ISBN:

9781789807332

Publisher:

Packt Publishing (2019)

Pages:

358

Reviewer:

Paul J. Floyd

Reviewed:

May 2026

Rating:

★★★☆☆


Recommended with reservations.

Reviewer’s note: Avoid or skip chapter 10.

This isn’t a book on hard core functional programming. Perhaps that’s why it has ‘Hands-On’ in the title. I’d say it’s more of a general overview. There are explanations of which parts of the standard library are based on functional programming. There are also parts explaining how to make imperative or object code more functional.

In addition to the programming side, there is also some coverage of testing (TDD and property-based testing), design and refactoring. There’s a fairly long example based on noughts-and-crosses (tic-tac-toe, if you must). Whilst the example was fine, I found myself wondering whether problems like detecting a winning move wouldn’t be even easier just using matrix multiplication. There’s a similar poker hand example.

Most of the example code in the book is shown using doctest. I wasn’t too comfortable with that and felt that just plain code would have been simpler to follow. That’s probably just a question of experience – this is the only book I’ve read that uses it and I’ve never used doctest for any projects.

Chapter 10 on ‘Performance’ is the main reason that I gave this book such a low mark. This chapter does discuss performance and does give some measurements but that is about all. The explanations are less than helpful.

  • “... the most likely explanation is that another caching mechanism kicks in – CPU or otherwise.” Why not measure the cache stats then?
  • Also, something weird is going on ...” Unless you believe that there are some capricious pixies living in your CPU then it isn’t weird and again measure cache stats and profiling cache events may shed more light on what is happening.
  • The difference is very great ... most likely the result of the GCC compiler.” Are you guessing? Profile the code and look at the assembler. I didn’t pay for the book to get speculation about how code might be working.

The worst is the section on memory usage. This ‘measures’ memory use using a script that polls /proc/PID/status. Noooo! Not only is this Linux only but it is also an unreliable way to measure memory use (unless you have a very friendly application that does not allocate heap memory more than once per 100ms). Please use a proper memory profiling tool like heaptrack, Google perftools or Valgrind massif.

Website: https://www.packtpub.com/en-gb/product/hands-on-functional-programming-with-c-9781789807332

Code Site: https://github.com/PacktPublishing/Hands-On-Functional-Programming-with-Cpp






Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.