{"id":5367,"date":"2018-01-06T08:50:52","date_gmt":"2018-01-06T08:50:52","guid":{"rendered":"https:\/\/www.modernescpp.com\/index.php\/clean-c\/"},"modified":"2018-01-06T08:50:52","modified_gmt":"2018-01-06T08:50:52","slug":"clean-c","status":"publish","type":"post","link":"https:\/\/www.modernescpp.com\/index.php\/clean-c\/","title":{"rendered":"Clean C++"},"content":{"rendered":"<p>I want to make a short detour from my long series of posts about the C++ Core Guidelines. I read the excellent book &#8220;Clean C++&#8221; in the last few days and I cannot hesitate to write a review. Here is my review.<\/p>\n<p><!--more--><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-5366\" src=\"https:\/\/www.modernescpp.com\/wp-content\/uploads\/2018\/01\/cleanCpp.png\" alt=\"cleanCpp\" width=\"282\" height=\"403\" srcset=\"https:\/\/www.modernescpp.com\/wp-content\/uploads\/2018\/01\/cleanCpp.png 282w, https:\/\/www.modernescpp.com\/wp-content\/uploads\/2018\/01\/cleanCpp-210x300.png 210w\" sizes=\"auto, (max-width: 282px) 100vw, 282px\" \/><\/p>\n<p>I hear often the question at the end of my seminars: <strong>What books should I read to become a better software developer?<\/strong> Here is one half of my answer: You should read <a href=\"https:\/\/en.wikipedia.org\/wiki\/Design_Patterns\">Design Pattern: Elements<\/a>&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Design_Patterns\">of reusable object-oriented software<\/a>, <a href=\"http:\/\/www.cs.wustl.edu\/~schmidt\/POSA\/\">Pattern-Oriented Software Architecture<\/a>, <a href=\"https:\/\/sites.google.com\/site\/unclebobconsultingllc\/books\">Clean Code<\/a>, <a href=\"http:\/\/wiki.c2.com\/?WorkingEffectivelyWithLegacyCode\">Working effectively with legacy code<\/a>, and <a href=\"https:\/\/martinfowler.com\/books\/uml.html\"><\/a><a href=\"https:\/\/martinfowler.com\/books\/uml.html\">UML Distilled.<\/a> Here is the other part of my answer: From the C++ perspective, you should read the books from <a href=\"https:\/\/en.wikipedia.org\/wiki\/Scott_Meyers\">Scott Meyers<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Herb_Sutter\">Herb Sutter<\/a>, and the <a href=\"http:\/\/isocpp.github.io\/CppCoreGuidelines\/CppCoreGuidelines\">C++ Core Guidelines<\/a>. In total there are more than 3000 pages full of very precious content.&nbsp;<\/p>\n<p>Now, my answer becomes quite easy. <strong>Read the book &#8220;Clean C++&#8221; by Stephan Roth.<\/strong> The book is the ideal fit for your breadth-first search. In your depth-first search read the classics, I mentioned before. Why?<\/p>\n<p>The author achieved it in 300 pages by giving a very good but not superficial overview of the topic we have to know as professional software developers. His book&nbsp;is based on C++11 but refers often to C++17. What I like in particular about the book is: <strong>It is not only about the Don&#8217;t but also the Dos<em>.<\/em><br \/><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>But first things first. <strong>Clean C++ has 9 chapters and a short introduction to UML.<\/strong> The first two chapters are programming language agnostic. In the chapters on <strong>unit testing<\/strong> and <strong>key principles of software development<\/strong> such as (Keep It Simple and Stupid (KISS), You Aren&#8217;t Gonna Need It (YAGNI), Don&#8217;t Repeat Yourself (DRY), or Principle Of Least Astonishment (PLA), the author talks about evergreens that will hold for sustainable software. The remaining chapters are also about good software practices but more from a C++ perspective. This new point of view starts with the chapter <strong>basics.<\/strong> Stephan Roth presents the key principles to write good names, comments, and functions. What has modern C++ to offer? A question that will be answered by the author in the next chapter &#8220;<strong>Advances Concepts of Modern C++<\/strong>&#8220;. C++ has its roots in <b>object orientation<\/b>&nbsp;but modern C++ becomes more and more dominant by <strong>functional<\/strong> concepts. What are the pros and cons of these paradigms? Questions, to which the book provide answers in about 60 pages. Unit-Tests should be used as a basis for <strong>Test-Driven Development<\/strong>. This is his focus in the next chapter Test-Driven Development (TDD). He shows in an elaborate example, how you can use TDD to convert Arabic numbers into Roman numerals. The chapter on <strong>Design Pattern and Idioms<\/strong> completes the book. One design pattern is very close to Stephan Roth: dependency injection. Dependency injection is the cure to get rid of the heavily discussed singleton anti-pattern. Admittedly he is right.<\/p>\n<p>What makes &#8220;Clean C++&#8221; such a great book that I will use it as a general recommendation at the end of my seminars? Do not have the cited classics all the important information? Definitely! The book &#8220;Clean <strong>C++&#8221; is from my point of view the only and pragmatic introduction to the topics for good software development in C++ which you can easily consume in one week.<\/strong> If you are done with this introduction, you should dive into more specific topics may they be general or C++ specific. This will keep you busy for the rest of your life as a software developer.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I want to make a short detour from my long series of posts about the C++ Core Guidelines. I read the excellent book &#8220;Clean C++&#8221; in the last few days and I cannot hesitate to write a review. Here is my review.<\/p>\n","protected":false},"author":21,"featured_media":5366,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[373],"tags":[],"class_list":["post-5367","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-review"],"_links":{"self":[{"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/posts\/5367","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/comments?post=5367"}],"version-history":[{"count":0,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/posts\/5367\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/media\/5366"}],"wp:attachment":[{"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/media?parent=5367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/categories?post=5367"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/tags?post=5367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}