ebook img

Design Patterns in Modern C++: Reusable Approaches for Object-Oriented Software Design PDF

250 Pages·2018·1.38 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Design Patterns in Modern C++: Reusable Approaches for Object-Oriented Software Design

Dmitri Nesteruk Design Patterns in Modern C++ Reusable Approaches for Object-Oriented Software Design Dmitri Nesteruk St. Petersburg, Russia Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the book’s product page, located at www.apress.com/9781484236024 . For more detailed information, please visit http://www.apress.com/source-code . ISBN 978-1-48423602-4 e-ISBN 978-1-4842-3603-1 https://doi.org/10.1007/978-1-4842-3603-1 Library of Congress Control Number: 2018940774 © Dmitri Nesteruk 2018 This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein. the material contained herein. Printed on acid-free paper Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800- SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation. Table of Contents Chapter 1: Introduction Preliminaries Who This Book Is For On Code Examples On Developer Tools Piracy Important Concepts Curiously Recurring Template Pattern Mixin Inheritance Properties The SOLID Design Principles Single Responsibility Principle Open-Closed Principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion Principle Time for Patterns! Part I: Creational Patterns Chapter 2 : Builder Scenario Simple Builder Fluent Builder Communicating Intent Groovy-Style Builder Composite Builder Summary Chapter 3: Factories Scenario Factory Method Factory Inner Factory Abstract Factory Functional Factory Summary Chapter 4: Prototype Object Constrution Ordinary Duplication Duplication via Copy Construction Serialization Prototype Factory Summary Chapter 5: Singleton Singleton as Global Object Classic Implementation Thread Safety The Trouble with Singleton Singletons and Inversion of Control Monostate Summary Part II: Structural Patterns Chapter 6: Adapter Scenario Adapter Adapter Temporaries Summary Chapter 7: Bridge The Pimpl Idiom Bridge Summary Chapter 8: Composite Array Backed Properties Grouping Graphic Objects Neural Networks Summary Chapter 9: Decorator Scenario Dynamic Decorator Static Decorator Functional Decorator Summary Chapter 10: Façade How the Terminal Works An Advanced Terminal Where’s the Façade? Summary Chapter 11: Flyweight User Names Boost.Flyweight String Ranges Naïve Approach Flyweight Implementation Summary Chapter 12: Proxy Smart Pointers Property Proxy Virtual Proxy Communication Proxy Summary Part III: Behavioral Patterns Chapter 13: Chain of Responsibility Scenario Pointer Chain Broker Chain Summary Chapter 14: Command Scenario Implementing the Command Pattern Undo Operations Composite Command Command Query Separation Summary Chapter 15: Interpreter Numeric Expression Evaluator Lexing Parsing Using Lexer and Parser Parsing with Boost.Spirit Abstract Syntax Tree Parser Printer Summary Chapter 16: Iterator Iterators in the Standard Library Traversing a Binary Tree Iteration with Coroutines Summary Chapter 17: Mediator Chat Room Mediator with Events Summary Chapter 18: Memento Bank Account Undo and Redo Summary

Description:
Apply modern C++17 to the implementations of classic design patterns. As well as covering traditional design patterns, this book fleshes out new patterns and approaches that will be useful to C++ developers. The author presents concepts as a fun investigation of how problems can be solved in differe
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.