REVIEW - Beautiful C++ - 30 Core Guidelines for Writing Clean, Safe, and Fast Code


Title:

Beautiful C++

30 Core Guidelines for Writing Clean, Safe, and Fast Code

Author:

J Guy Davidson, Kate Gregory

Publisher:

Addison-Wesley Professional (2021)

Pages:

352

Reviewer:

Anthony Williams

Reviewed:

May 2022

Rating:

★★★★★


Verdict: Highly Recommended

This book is subtitled 30 Core Guidelines for Writing Clean, Safe, and Fast Code, and covers 30 guidelines chosen from the ‘C++ Core Guidelines’ [1], with each chapter focusing on a single guideline.

If you’re not familiar with the ‘C++ Core Guidelines’, they are a rather extensive list of guidelines for writing C++ code, edited by Herb Sutter and Bjarne Stroustrup, with considerable contribution from the community – the Github page currently lists 294 contributors. The full list of guidelines covers every aspect of C++ development, and includes guidelines that range from the very general (such as ‘P.8 Don’t Leak Resources’) to the very specific (such as ‘Enum.5 Don’t use ALL_CAPS for enumerators’). The authors of this book have chosen 30 guidelines which they think are especially valuable, and written a detailed chapter on each of them.

Each chapter is an easy read, with discussion of the guideline itself, along with examples of the problems that can arise from not following the guideline, and how it can improve your code. There are also plenty of anecdotes from the authors’ careers. The chapters are standalone and self-contained, so can be read in any order, and are short enough that you could read a chapter in a single sitting, like you would a blog post or magazine article.

Another nice feature is that the authors have provided a set of examples which are available on Compiler Explorer [2].

I would strongly recommend that every C++ developer reads this book. If you’ve not previously thought about the issues covered, you might find that some of the guidelines covered improve your code. Even if you already follow all these guidelines, it’s an entertaining read, and the copious links to the other C++ Core Guidelines may lead to something you haven’t thought about. Plus, if you are ever mentoring other developers, then it gives you some clear examples and rationale to use when explaining how and why they should follow these guidelines.

Website: https://www.pearson.com/us/higher-education/program/Davidson-Beautiful-C-30-Core-Guidelines-for-Writing-Clean-Safe-and-Fast-Code/PGM100003103132.html

References

[1] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#main

[2] https://godbolt.org/z/cg30-ch0.0






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.