Roth | Clean C++ | E-Book | www.sack.de
E-Book

E-Book, Englisch, 291 Seiten

Reihe: Apress Access Books

Roth Clean C++

Sustainable Software Development Patterns and Best Practices with C++ 17
1. ed
ISBN: 978-1-4842-2793-0
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark

Sustainable Software Development Patterns and Best Practices with C++ 17

E-Book, Englisch, 291 Seiten

Reihe: Apress Access Books

ISBN: 978-1-4842-2793-0
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark



Write maintainable, extensible, and durable software with modern C++. This book is a must for every developer, software architect, or team leader who is interested in good C++ code, and thus also wants to save development costs. If you want to teach yourself about writing clean C++, Clean C++ is exactly what you need. It is written to help C++ developers of all skill levels and shows by example how to write understandable, flexible, maintainable, and efficient C++ code. Even if you are a seasoned C++ developer, there are nuggets and data points in this book that you will find useful in your work.
If you don't take care with your code, you can produce a large, messy, and unmaintainable beast in any programming language. However, C++ projects in particular are prone to be messy and tend to slip into bad habits. Lots of C++ code that is written today looks as if it was written in the 1980s.

It seems that C++ developers have been forg
otten by those who preach Software Craftsmanship and Clean Code principles. The Web is full of bad, but apparently very fast and highly optimized C++ code examples, with cruel syntax that completely ignores elementary principles of good design and well-written code. This book will explain how to avoid this scenario and how to get the most out of your C++ code. You'll find your coding becomes more efficient and, importantly, more fun.
What You'll Learn
  • Gain sound principles and rules for clean coding in C++
  • Carry out test driven development (TDD)
  • Discover C++ design patterns and idioms
  • Apply these design patterns
Who This Book Is For
Any C++ developer and software engineer with an interest in producing better code. 


Roth Clean C++ jetzt bestellen!

Autoren/Hrsg.


Weitere Infos & Material


1;Contents at a Glance;5
2;Contents;6
3;About the Author;12
4;About the Technical Reviewer;13
5;Acknowledgments;14
6;Chapter 1: Introduction;15
6.1;Software Entropy;16
6.2;Clean Code;17
6.3;Why C++?;18
6.4;C++11 – The Beginning of a New Era;18
6.5;Who This Book Is For;19
6.6;Conventions Used in This Book;19
6.6.1;Sidebars;19
6.6.2;Notes, Tips, and Warnings;20
6.6.3;Code Samples;20
6.6.3.1;Coding Style;20
6.7;Companion Website and Source Code Repository;21
6.8;UML Diagrams;21
7;Chapter 2: Build a Safety Net;22
7.1;The Need for Testing;22
7.2;Introduction into Testing;24
7.3;Unit Tests;26
7.4;What about QA?;27
7.5;Rules for Good Unit Tests;28
7.5.1;Test Code Quality;28
7.5.2;Unit Test Naming;28
7.5.3;Unit Test Independence;29
7.5.4;One Assertion per Test;30
7.5.5;Independent Initialization of Unit Test Environments;31
7.5.6;Exclude Getters and Setters;31
7.5.7;Exclude Third-Party Code;31
7.5.8;Exclude External Systems;32
7.5.9;And What Do We Do with the Database?;32
7.5.10;Don’t Mix Test Code with Production Code;32
7.5.11;Tests Must Run Fast;35
7.5.12;Test Doubles (Fake Objects);35
8;Chapter 3: Be Principled;39
8.1;What Is a Principle?;39
8.2;KISS;40
8.3;YAGNI;40
8.4;DRY;41
8.5;Information Hiding;41
8.6;Strong Cohesion;44
8.7;Loose Coupling;47
8.8;Be Careful with Optimizations;51
8.9;Principle of Least Astonishment (PLA);51
8.10;The Boy Scout Rule;51
9;Chapter 4: Basics of Clean C++;53
9.1;Good Names;53
9.1.1;Names Should Be Self-Explanatory;55
9.1.2;Use Names from the Domain;56
9.1.3;Choose Names at an Appropriate Level of Abstraction;57
9.1.4;Avoid Redundancy When Choosing a Name;58
9.1.5;Avoid Cryptic Abbreviations;58
9.1.6;Avoid Hungarian Notation and Prefixes;59
9.1.7;Avoid Using the Same Name for Different Purposes;60
9.2;Comments;60
9.2.1;Let the Code Tell a Story;61
9.2.2;Do Not Comment Obvious Things;61
9.2.3;Don’t Disable Code with Comments;62
9.2.4;Don’t Write Block Comments;62
9.2.4.1;Don’t Use Comments to Substitute Version Control;64
9.2.5;The Rare Cases Where Comments Are Useful;65
9.2.5.1;Documentation Generation from Source Code;66
9.3;Functions;68
9.3.1;One Thing, No More!;70
9.3.2;Let Them Be Small;71
9.3.2.1;“But the Call Time Overhead!”;71
9.3.3;Function Naming;72
9.3.4;Use Intention-Revealing Names;73
9.3.5;Arguments and Return Values;73
9.3.5.1;Number of Arguments;74
9.3.5.2;Avoid Flag Arguments;75
9.3.5.3;Avoid Output Arguments;77
9.3.5.4;Don’t Pass or Return 0 (NULL, nullptr);79
9.3.5.5;Strategies to Avoid Regular Pointers;80
9.3.5.5.1;Prefer simple object construction on the stack instead of on the heap;80
9.3.5.5.2;In a function’s argument list, use (const) references instead of pointers;82
9.3.5.5.3;If it is inevitable to deal with a pointer to a resource, use a smart one;82
9.3.5.5.4;If an API returns a raw pointer…;82
9.3.5.6;The Power of const correctness;82
9.4;About Old C-style in C++ Projects;84
9.4.1;Prefer C++ Strings and Streams over Old C-Style char*;84
9.4.2;Avoid Using printf(), sprintf(), gets(), etc.;86
9.4.3;Prefer Standard Library Containers over Simple C-style Arrays;89
9.4.4;Use C++ casts Instead of Old C-Style Casts;92
9.4.5;Avoid Macros;94
10;Chapter 5: Advanced Concepts of Modern C++;96
10.1;Managing Resources;96
10.1.1;Resource Acquisition Is Initialization (RAII);98
10.1.2;Smart Pointers;98
10.1.2.1;Unique Ownership with std::unique_ptr



Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.