3061Instant download Practical C++ Design: From Programming to Architecture Adam B. Singer pdf all chapter
3061Instant download Practical C++ Design: From Programming to Architecture Adam B. Singer pdf all chapter
com
https://ebookmeta.com/product/practical-c-design-from-
programming-to-architecture-adam-b-singer/
OR CLICK HERE
DOWLOAD NOW
https://ebookmeta.com/product/practical-c-design-from-programming-to-
architecture-2nd-edition-adam-b-singer/
ebookmeta.com
https://ebookmeta.com/product/practical-c-design-from-programming-to-
architecture-1st-edition-adam-b-singer/
ebookmeta.com
https://ebookmeta.com/product/the-dark-side-of-social-media-
psychological-managerial-and-societal-perspectives-1st-edition-pavica-
sheldon/
ebookmeta.com
Forensic Mental Health 2nd Edition Michele P. Bratina
https://ebookmeta.com/product/forensic-mental-health-2nd-edition-
michele-p-bratina/
ebookmeta.com
https://ebookmeta.com/product/minor-emergencies-philip-m-buttaravoli/
ebookmeta.com
https://ebookmeta.com/product/in-the-wake-of-the-mongols-the-making-
of-a-new-social-order-in-north-china-1200-1600-27th-edition-jinping-
wang/
ebookmeta.com
https://ebookmeta.com/product/the-road-not-taken-a-selection-of-
robert-frost-s-poems-frost/
ebookmeta.com
https://ebookmeta.com/product/united-states-anna-obiols/
ebookmeta.com
CompTIA A Complete Practice Tests Exam Core 1 220 1001 and
Exam Core 2 220 1002 2nd Edition Jeff T Parker Quentin
Docter
https://ebookmeta.com/product/comptia-a-complete-practice-tests-exam-
core-1-220-1001-and-exam-core-2-220-1002-2nd-edition-jeff-t-parker-
quentin-docter/
ebookmeta.com
Practical
C++ Design
From Programming to Architecture
—
Second Edition
—
Adam B. Singer
Practical C++ Design
From Programming to Architecture
Second Edition
Adam B. Singer
Practical C++ Design: From Programming to Architecture
Adam B. Singer
The Woodlands, TX, USA
Chapter 2: Decomposition���������������������������������������������������������������������������������������� 9
2.1 The Elements of a Good Decomposition�������������������������������������������������������������������������������� 10
2.2 Selecting an Architecture������������������������������������������������������������������������������������������������������ 12
2.2.1 Multitiered Architecture������������������������������������������������������������������������������������������������ 13
2.2.2 Model-View-Controller (MVC) Architecture������������������������������������������������������������������� 14
2.2.3 Architectural Patterns Applied to the Calculator����������������������������������������������������������� 16
2.2.4 C
hoosing the Calculator’s Architecture������������������������������������������������������������������������ 17
2.3 I nterfaces������������������������������������������������������������������������������������������������������������������������������ 17
2.3.1 C
alculator Use Cases���������������������������������������������������������������������������������������������������� 18
2.3.2 A
nalysis of Use Cases��������������������������������������������������������������������������������������������������� 21
2.3.3 A Quick Note on Actual Implementation����������������������������������������������������������������������� 28
2.4 Assessment of Our Current Design��������������������������������������������������������������������������������������� 29
2.5 Implementing Our Design Using C++20 Modules����������������������������������������������������������������� 29
2.5.1 W
hy Modules?�������������������������������������������������������������������������������������������������������������� 29
2.5.2 U
sing Legacy Headers�������������������������������������������������������������������������������������������������� 33
v
Table of Contents
vi
Table of Contents
vii
Table of Contents
viii
Table of Contents
References������������������������������������������������������������������������������������������������������������ 279
Index��������������������������������������������������������������������������������������������������������������������� 283
ix
About the Author
Adam B. Singer graduated first in his class at the Georgia Institute of Technology in
1999 with a bachelor’s degree in chemical engineering. He subsequently attended
the Massachusetts Institute of Technology (MIT) on a National Defense Science and
Engineering Graduate Fellowship. He graduated from MIT with a Ph.D. in chemical
engineering in 2004 after defending his thesis titled “Global Dynamic Optimization.”
Since graduation, Adam has been employed by ExxonMobil1 in various Upstream
organizations, including research, information technology, and digital transformation.
He has held both technical and managerial roles in software development, design, and
project management in areas such as mathematical optimization, reservoir modeling
and simulation, decision support under uncertainty, basin modeling, well log modeling,
process stratigraphy, geoscience platform architecture, and data science. He has also
served on and chaired committees designing in-house training in the areas of technical
software development and computational and applied mathematics. He is currently the
Senior Principal Digital Architect for ExxonMobil.
Adam additionally held the title of adjunct assistant professor in the Department of
Computational and Applied Mathematics at Rice University from 2007 to 2012. In 2006
and 2007, he taught a graduate-level course, CAAM 520, on computational science.
The course focused on the design and implementation of high-performance parallel
programs.
1
The advice, information, and conclusions discussed in this book are those of the author and
have not been endorsed by, or reflect the opinions or practices of, ExxonMobil Corporation or its
affiliates.
xi
About the Technical Reviewer
German Gonzalez-Morris is a software architect/engineer working with C/C++,
Java, and different application containers, in particular with WebLogic Server.
He has developed various applications using JEE, Spring, and Python. His areas
of expertise also include OOP, Java/JEE, Python, design patterns, algorithms, Spring
Core/MVC/security, and microservices. German has worked with performance
messaging, RESTful API, and transactional systems. For more information about him,
visit www.linkedin.com/in/german-gonzalez-morris.
xiii
Preface
Motivation of the Author
Throughout my career, I have mentored both students and fellow employees in
programming, and many of them have suggested that I write my thoughts down in book
form. However, I have typically responded with the rebuttal that I felt I had nothing novel
to present. Being a largely self-taught programmer, I have always been able to rattle off
a long list of books from which I have derived most of my knowledge. Therefore, what
could I write about that has not already been said?
I came to realize, however, that the majority of books that I had encountered
tended to focus only on pieces of design or implementation rather than taking a holistic
approach. For example, if one wants to learn the C++ language, Stroustrup [30] or
Lippman and Lajoie [19] are excellent references. For learning C++ best practices, one
need only read the books by Sutter [31, 32, 33], Sutter and Alexandrescu [34], or Meyers
[22, 21, 23]. Of course, learning to program extends well beyond C++. For data structures
and algorithms, there are always the classics by Knuth [15, 16, 17] or the more accessible
and concise book by Cormen et al. [10]. To learn object-oriented analysis and design,
the book by Booch et al. [8] is an excellent reference. Of course, design patterns can be
learned from Gamma et al. [11], and general programming practices can be learned from
many books such as those by McConnell [20], Spinellis [29], or Kernighan and Pike [14].
Certainly, the deeper the specialty one seeks, the more esoteric the book one can
find (and should eventually read). This book is not such a book. Rather, I have striven to
write a book that operates from the premise that the reader already possesses a working
knowledge of the information encased in works such as the aforementioned titles. In this
book, I instead attempt to ground the reader’s theoretical knowledge of design through
practice using a single case study.
xv
Preface
Target Audience
As mentioned previously, the goal of this book is not to present any specific topic
but rather to explore the interrelationship of often compartmentalized subjects. The
successful combination of these components to form a cohesive, maintainable, elegant
piece of software is, in essence, design. As such, this book is intended to target practicing
professionals, in particular those who have several years of development experience but
who do not yet possess sufficient experience to architect independently a large software
project.
Because my intent is to emphasize utilization of one’s existing knowledge effectively
to design software, I make little effort to explain individual topics in great depth. I believe
too many books classified as intermediate to advanced fail because the author devotes
too much content describing prerequisites. The result is a massive tome filled with
unnecessary detail for the advanced reader, while the beginner is left with a long and
complicated exposition that is still inaccessible because the beginner does not possess
sufficient knowledge or experience to grasp the subject regardless of the amount of detail
devoted to the description. I have, therefore, aimed for conciseness over completeness.
Often, I simply refer the reader to relevant material rather than myself describe a
background topic in great detail. While this strategy may indeed make this book difficult
for beginners, I hope experienced professionals appreciate both the brevity of the book
and its tone, which assumes the reader is competent at their craft.
xvi
Preface
hopefully this book will enable the reader to learn from the author’s experiences without
having to repeat his mistakes. That is, I hope I have created a book that can serve as a
self-contained master class in design.
Language Selection
Design as an abstract concept can be taught in the absence of a particular programming
language. However, once committed to a concrete example, a specific language must
be chosen for the implementation. I decided to write the case study exclusively using
C++. While every line of the program does not appear in the text, all of the source code
is available for the reader to examine. Despite this book’s primary focus on design,
reading the source code is a good way to learn how implementation details in a specific
language enable or, at least, facilitate a chosen design. The source code also serves as
a high-quality (I hope) exemplar of a modern C++ implementation of a complete user
application. I highly recommend reading and modifying the source code in conjunction
with reading the text.
The decision to use C++ does not imply that C++ is the best choice for all programs,
and, in fact, it may not even be the best choice for the program examined in this book.
However, to ground the abstraction, a concrete language had to be selected. I chose
xvii
Preface
C++ because it is standardized, widely deployed, and available at zero cost on many
platforms. Selfishly, I also chose C++ because it is my most proficient language. While I
could, perhaps, have chosen another language meeting the aforementioned objective
criteria (e.g., Python), the resulting code would probably have been functional but
nonidiomatic due to my relative lack of expertise.
During the writing of the first edition of this book, C++0x was ratified as C++11
and then updated as C++14. C++11, with smart pointers, move semantics, lambdas,
variadic templates, and a host of other new features, fundamentally changed how
one could express a design in the C++ language. My objective at the time was to avoid
incorporating modern C++ features where they were inappropriate just to demonstrate
usage. Instead, I sought to highlight how these new language elements could be used
effectively in the design of a large-scale program. Hopefully, I achieved my objective.
Design and architecture have not changed significantly since the publication of
the first edition of this book, so why write a second edition? If this were an abstract
design book, such an update would be unnecessary. However, since the publication
of the first edition, C++17 and C++20 were both ratified. Because the book’s case study
is accompanied by a complete implementation, expressing a concrete design using
C++ has evolved with new language developments. While C++17 added several new
implementation features, none of these features substantially impacted the ability to
express designs in the language. C++20, on the other hand, is different.
C++20, maybe even more so than C++11, fundamentally changes how designs may
be expressed in C++. In particular, four new major language features were added: ranges,
coroutines, concepts, and modules, all of which make, at least, a brief appearance in
the case study. The ranges library does not fundamentally alter program design. It does,
however, fundamentally change the way algorithms can be implemented, especially
with the better integration of the functional programming paradigm as enabled through
views. Coroutines add cooperative multitasking to the C++ language. We will see that
even in a single-threaded program such as the one described in this book, coroutines
can be used to express an idea from the first edition differently. Concepts change the
way generic programs are constructed. This book’s design does not make extensive
use of templates; therefore, concepts make only the briefest of appearances. Lastly,
C++20 finally brings modularization to C++ as a formal language construct. This change
drastically impacts how code can be organized, including, in many instances, completely
eliminating the need for header files. We will explore the usage of C++ modules, and
their interaction with dynamically linked libraries, in some depth.
xviii
Another Random Document on
Scribd Without Any Related Topics
»Kuten näette, madame, teen vaaran uhatessa kaikkeni
torjuakseni sen hänestä.»
»Manuel.»
Sitten ilmestyi uusi este kuninkaallisen perheen tielle. Melkoinen
joukko miehiä ja naisia seisoi uhkaavin elein ja aseita heilutellen
portailla ja pengermällä, joiden kautta oli kuljettava Tuileriein
puutarhasta Maneesiin.
»Poikani, poikani!»
Nyt luultiin siis, että oli päästy kapinasta voitolle, ja päätettiin millä
hinnalla tahansa vallata myöskin tuo pikku patteri, mutta silloin
kuului laiturikadun taholta rummunpärinää ja raskaan tykistön
kovaäänistä kolinaa. Sitä armeijaa kuningas oli katsellut kaukolasilla
Louvren kokoelmasalin ikkunasta..
Billot halusi taistella siellä, missä Pitou oli kaatunut. Hän toivoi
sentään, että Pitou oli vain haavoittunut, joten hän saisi tehdä
Pitoulle Royale-pihalla saman palveluksen, jonka Pitou oli tehnyt
hänelle Mars-kentällä. Hän astui siis ensimmäisten mukana
keskipihaan. Veren lemu oli niin kirpeä, että olisi luullut tulleensa
teurastamoon, ja sitä huokui ruumiskasoista melkein savunkaltaisena
huuruna.
Äkkiä Billot tunsi, että joku syleili häntä takaapäin. Hän kääntyi
rutosti, arvellen joutuneensa vihollisen ahdistettavaksi, mutta
nähdessään syleilijän hän huudahti ilosta.
Kuningas istuutui.
Kuka oli tämä mies, joka salaman lailla leimahti esille vain ukkosen
riehuessa?
Updated editions will replace the previous one—the old editions will
be renamed.