Buy new:
$52.24
FREE delivery Friday, May 17
Ships from: Amazon
Sold by: Prime Deals, USA
$52.24
FREE Returns
FREE delivery Friday, May 17. Order within 13 hrs 31 mins
Only 1 left in stock - order soon.
$$52.24 () Includes selected options. Includes initial monthly payment and selected options. Details
Price
Subtotal
$$52.24
Subtotal
Initial payment breakdown
Shipping cost, delivery date, and order total (including tax) shown at checkout.
Ships from
Amazon
Ships from
Amazon
Returns
30-day easy returns
30-day easy returns
This item can be returned in its original condition for a full refund or replacement within 30 days of receipt.
Returns
30-day easy returns
This item can be returned in its original condition for a full refund or replacement within 30 days of receipt.
Payment
Secure transaction
Your transaction is secure
We work hard to protect your security and privacy. Our payment security system encrypts your information during transmission. We don’t share your credit card details with third-party sellers, and we don’t sell your information to others. Learn more
Payment
Secure transaction
We work hard to protect your security and privacy. Our payment security system encrypts your information during transmission. We don’t share your credit card details with third-party sellers, and we don’t sell your information to others. Learn more
$43.00
FREE Returns
The book's pages and cover remain undamaged, although the spine may exhibit some signs of wear. There may be some limited notes or highlighting. The book's pages and cover remain undamaged, although the spine may exhibit some signs of wear. There may be some limited notes or highlighting. See less
FREE delivery Friday, May 17. Order within 13 hrs 31 mins
Only 1 left in stock - order soon.
$$52.24 () Includes selected options. Includes initial monthly payment and selected options. Details
Price
Subtotal
$$52.24
Subtotal
Initial payment breakdown
Shipping cost, delivery date, and order total (including tax) shown at checkout.
Access codes and supplements are not guaranteed with used items.
Kindle app logo image

Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.

Read instantly on your browser with Kindle for Web.

Using your mobile phone camera - scan the code below and download the Kindle app.

QR code to download the Kindle App

Something went wrong. Please try your request again later.

Modern C++ Design: Generic Programming and Design Patterns Applied 1st Edition

4.6 4.6 out of 5 stars 200 ratings

{"desktop_buybox_group_1":[{"displayPrice":"$52.24","priceAmount":52.24,"currencySymbol":"$","integerValue":"52","decimalSeparator":".","fractionalValue":"24","symbolPosition":"left","hasSpace":false,"showFractionalPartIfEmpty":true,"offerListingId":"YCu4lHRs9UdZrFE6ne%2BoRj2XUHrZ2s74KOtvBjmZOxLu%2FGEp5SkPy50a4ivi0cCB4gi4lxpTX6noDvFDgLGbMCJ00%2Fts%2FqHIfIk3MpO38jRHEekztEfS9NTI7bLtpCsF%2Bj1NKfgk%2B9TEYEr1Ui3LE0Thlud9e4yPNYb8Zmiv%2FhGX4sNGE3HWwg%3D%3D","locale":"en-US","buyingOptionType":"NEW","aapiBuyingOptionIndex":0}, {"displayPrice":"$43.00","priceAmount":43.00,"currencySymbol":"$","integerValue":"43","decimalSeparator":".","fractionalValue":"00","symbolPosition":"left","hasSpace":false,"showFractionalPartIfEmpty":true,"offerListingId":"YCu4lHRs9UdZrFE6ne%2BoRj2XUHrZ2s74r6garcmO9l9TRiPwpYIN1RnHOH%2B1Nn5aD94XeUONrb6zy2ZbaVDbwrxXQuO4QSVEg1rjzgNAws95XOMYfHr2LmpDTSO752PlA7l%2FdWG%2BX7NQeAe4CQKPvR335697sn4Hpz16bNEByu7kOABDlAM0sg%3D%3D","locale":"en-US","buyingOptionType":"USED","aapiBuyingOptionIndex":1}]}

Purchase options and add-ons

In Modern C++ Design, Andrei Alexandrescu opens new vistas for C++ programmers. Displaying extraordinary creativity and programming virtuosity, Alexandrescu offers a cutting-edge approach to design that unites design patterns, generic programming, and C++, enabling programmers to achieve expressive, flexible, and highly reusable code.

This book introduces the concept of generic components―reusable design templates that produce boilerplate code for compiler consumption―all within C++. Generic components enable an easier and more seamless transition from design to application code, generate code that better expresses the original design intention, and support the reuse of design structures with minimal recoding.

The author describes the specific C++ techniques and features that are used in building generic components and goes on to implement industrial strength generic components for real-world applications. Recurring issues that C++ developers face in their day-to-day activity are discussed in depth and implemented in a generic way. These include:

  • Policy-based design for flexibility
  • Partial template specialization
  • Typelists―powerful type manipulation structures
  • Patterns such as Visitor, Singleton, Command, and Factories
  • Multi-method engines

For each generic component, the book presents the fundamental problems and design options, and finally implements a generic solution.

Read more Read less

Amazon First Reads | Editors' picks at exclusive prices

Frequently bought together

$52.24
Get it as soon as Friday, May 17
Only 1 left in stock - order soon.
Sold by Prime Deals, USA and ships from Amazon Fulfillment.
+
$41.78
Get it as soon as Monday, May 20
Only 1 left in stock - order soon.
Sold by MCHUNTER BOOKS and ships from Amazon Fulfillment.
+
$26.00
Only 1 left in stock - order soon.
Ships from and sold by Uscat Deals.
Total price:
To see our price, add these items to your cart.
Details
Added to Cart
These items are shipped from and sold by different sellers.
Choose items to buy together.

Editorial Reviews

From the Inside Flap

You might be holding this book in a bookstore, asking yourself whether you should buy it. Or maybe you are in your employers library, wondering whether you should invest time in reading it. I know you dont have time, so Ill cut to the chase. If you have ever asked yourself how to write higher-level programs in C++, how to cope with the avalanche of irrelevant details that plague even the cleanest design, or how to build reusable components that you dont have to hack into each time you take them to your next application, then this book is for you.

Imagine the following scenario. You come from a design meeting with a couple of printed diagrams, scribbled with your annotations. Okay, the event type passed between these objects is not char anymore; its int. You change one line of code. The smart pointers to Widget are too slow; they should go unchecked. You change one line of code. The object factory needs to support the new Gadget class just added by another department. You change one line of code.

You changed the design. Compile. Link. Done.

Well, there is something wrong with this scenario, isnt there? A much more likely scenario is this: You come from the meeting in a hurry because you have a pile of work to do. You fire a global search. You perform surgery on code. You add code. You introduce bugs. You remove the bugs . . . thats the way a programmers job is, right? Although this book cannot possibly promise you the first scenario, it is nonetheless a resolute step in that direction. It tries to present C++ as a newly discovered language for software architects.

Traditionally, code is the most detailed and intricate aspect of a software system. Historically, in spite of various levels of language support for design methodologies (such as object orientation), a significant gap persisted between the blueprints of a program and its code because the code must take care of the ultimate details of the implementation and of many ancillary tasks. The intent of the design is, more often than not, dissolved in a sea of quirks.

This book presents a collection of reusable design artifacts, called generic components, together with the techniques that make them possible. These generic components bring their users the well-known benefits of libraries, but in the broader space of system architecture. The coding techniques and the implementations provided focus on tasks and issues that traditionally fall in the area of design, activities usually done before coding. Because of their high level, generic components make it possible to map intricate architectures to code in unusually expressive, terse, and easy-to-maintain ways.

Three elements are reunited here: design patterns, generic programming, and C++. These elements are combined to achieve a very high rate of reuse, both horizontally and vertically. On the horizontal dimension, a small amount of library code implements a combinatorialand essentially open-endednumber of structures and behaviors. On the vertical dimension, the generality of these components makes them applicable to a vast range of programs.

This book owes much to design patterns, powerful solutions to ever-recurring problems in object-oriented development. Design patterns are distilled pieces of good designrecipes for sound, reusable solutions to problems that can be encountered in manycontexts. Design patterns concentrate on providing a suggestive lexicon for designs to be conveyed. They describe the problem, a time-proven solution with its variants, and the consequences of choosing each variant of that solution. Design patterns go above and beyond anything a programming language, no matter how advanced, could possibly express. By following and combining certain design patterns, the components presented in this book tend to address a large category of concrete problems.

Generic programming is a paradigm that focuses on abstracting types to a narrow collection of functional requirements and on implementing algorithms in terms of these requirements. Because algorithms define a strict and narrow interface to the types they operate on, the same algorithm can be used against a wide collection of types. The implementations in this book use generic programming techniques to achieve a minimal commitment to specificity, extraordinary terseness, and efficiency that rivals carefully handcrafted code.

C++ is the only implementation tool used in this book. You will not find in this book code that implements nifty windowing systems, complex networking libraries, or clever logging mechanisms. Instead, you will find the fundamental components that make it easy to implement all of the above, and much more. C++ has the breadth necessary to make this possible. Its underlying C memory model ensures raw performance, its support for polymorphism enables object-oriented techniques, and its templates unleash an incredible code generation machine. Templates pervade all the code in the book because they allow close cooperation between the user and the library. The user of the library literally controls he way code is generated, in ways constrained by the library. The role of a generic component library is to allow user-specified types and behaviors to be combined with generic components in a sound design. Because of the static nature of the technique used, errors in mixing and matching the appropriate pieces are usually caught during compile time.

This books manifest intent is to create generic componentspreimplemented pieces of design whose main characteristics are flexibility, versatility, and ease of use. Generic components do not form a framework. In fact, their approach is complementarywhereas a framework defines interdependent classes to foster a specific object model, generic components are lightweight design artifacts that are independent of each other, yet can be mixed and matched freely. They can be of great help in implementing frameworks.

Audience

The intended audience of this book falls into two main categories. The first category is that of experienced C++ programmers who want to master the most modern library writing techniques. The book presents new, powerful C++ idioms that have surprising capabilities, some of which werent even thought possible. These idioms are of great help in writing high-level libraries. Intermediate C++ programmers who want to go a step further will certainly find the book useful, too, especially if they invest a bit of perseverance. Although pretty hard-core C++ code is sometimes presented, it is thoroughly explained.

The second category consists of busy programmers who need to get the job done without undergoing a steep learning investment. They can skim the most intricate details of implementation and concentrate on using the provided library. Each chapter has an introductory explanation and ends with a Quick Facts section. Programmers will find these features a useful reference in understanding and using the components. The components can be understood in isolation, are very powerful yet safe, and are a joy to use.

You need to have a solid working experience with C++ and, above all, the desire to learn more. A degree of familiarity with templates and the Standard Template Library (STL) is desirable.

Having an acquaintance with design patterns (Gamma et al. 1995) is recommended but not mandatory. The patterns and idioms applied in the book are described in detail. However, this book is not a pattern bookit does not attempt to treat patterns in full generality. Because patterns are presented from the pragmatic standpoint of a library writer, even readers interested mostly in patterns may find the perspective refreshing, if constrained.

Loki

The book describes an actual C++ library called Loki. Loki is the god of wit and mischief in Norse mythology, and the authors hope is that the librarys originality and flexibility will remind readers of the playful Norse god. All the elements of the library live in the namespace Loki. The namespace is not mentioned in the coding examples because it would have unnecessarily increased indentation and the size of the examples. Loki is freely available; you can download it from awl/cseng/titles/0-201-70431-5.

Except for its threading part, Loki is written exclusively in standard C++. This, alas, means that many current compilers cannot cope with parts of it. I implemented and tested Loki using Metrowerks CodeWarrior Pro 6.0 and Comeau C++ 4.2.38, both on Windows. It is likely that KAI C++ wouldnt have any problem with the code, either. As vendors release new, better compiler versions, you will be able to exploit everything Loki has to offer.

Lokis code and the code samples presented throughout the book use a popular coding standard originated by Herb Sutter. Im sure you will pick it up easily. In a nutshell,

Classes, functions, and enumerated types look LikeThis.

Variables and enumerated values look likeThis.

Member variables look likeThis_.

Template parameters are declared with class if they can be only a user-defined type, and with typename if they can also be a primitive type.

From the Back Cover

Modern C++ Designis an important book. Fundamentally, it demonstrates ‘generic patterns’ or ‘pattern templates’ as a powerful new way of creating extensible designs in C++–a new way to combine templates and patterns that you may never have dreamt was possible, but is. If your work involves C++ design and coding, you should read this book. Highly recommended.
–Herb Sutter

What’s left to say about C++ that hasn’t already been said? Plenty, it turns out.
–From the Foreword by John Vlissides

In Modern C++ Design, Andrei Alexandrescu opens new vistas for C++ programmers. Displaying extraordinary creativity and programming virtuosity, Alexandrescu offers a cutting-edge approach to design that unites design patterns, generic programming, and C++, enabling programmers to achieve expressive, flexible, and highly reusable code.

This book introduces the concept of generic components–reusable design templates that produce boilerplate code for compiler consumption–all within C++. Generic components enable an easier and more seamless transition from design to application code, generate code that better expresses the original design intention, and support the reuse of design structures with minimal recoding.

The author describes the specific C++ techniques and features that are used in building generic components and goes on to implement industrial strength generic components for real-world applications. Recurring issues that C++ developers face in their day-to-day activity are discussed in depth and implemented in a generic way. These include:

  • Policy-based design for flexibility
  • Partial template specialization
  • Typelists–powerful type manipulation structures
  • Patterns such as Visitor, Singleton, Command, and Factories
  • Multi-method engines

For each generic component, the book presents the fundamental problems and design options, and finally implements a generic solution.

In addition, an accompanying Web site, http://www.awl.com/cseng/titles/0-201-70431-5, makes the code implementations available for the generic components in the book and provides a free, downloadable C++ library, called Loki, created by the author. Loki provides out-of-the-box functionality for virtually any C++ project.

Get a value-added service! Try out all the examples from this book at www.codesaw.com. CodeSaw is a free online learning tool that allows you to experiment with live code from your book right in your browser.



0201704315B11102003

Product details

  • Publisher ‏ : ‎ Addison-Wesley Professional; 1st edition (February 13, 2001)
  • Language ‏ : ‎ English
  • Paperback ‏ : ‎ 360 pages
  • ISBN-10 ‏ : ‎ 0201704315
  • ISBN-13 ‏ : ‎ 978-0201704310
  • Item Weight ‏ : ‎ 2.31 pounds
  • Dimensions ‏ : ‎ 7.35 x 1 x 9.15 inches
  • Customer Reviews:
    4.6 4.6 out of 5 stars 200 ratings

About the author

Follow authors to get new release updates, plus improved recommendations.
Andrei Alexandrescu
Brief content visible, double tap to read full content.
Full content visible, double tap to read brief content.

Andrei Alexandrescu coined the colloquial term "modern C++", used today to describe a collection of important C++ styles and idioms. His eponymous book on the topic, Modern C++ Design: Generic Programming and Design Patterns Applied (Addison-Wesley, 2001), revolutionized C++ programming and produced a lasting influence not only on subsequent work on C++, but also on other languages and systems. With Herb Sutter, Andrei is also the coauthor of C++ Coding Standards: 101 Rules, Guidelines, and Best Practices (Addison-Wesley, 2004). Through Andrei's varied work on libraries and applications, as well as his research in machine learning and natural language processing, he has garnered a solid reputation in both industrial and academic circles. Since 2006, he has been second-in-command to Walter Bright, the D programming language inventor and initial implementer. Andrei has been the key designer of many important features of D and has authored a large part of D's standard library, positioning him to write an authoritative book on the new language, appropriately entitled, The D Programming Language. Andrei holds a Ph.D. in Computer Science from the University of Washington and a B.Sc. in Electrical Engineering from University "Politehnica" Bucharest. He works as a Research Scientist for Facebook.

Customer reviews

4.6 out of 5 stars
4.6 out of 5
200 global ratings
Used product delivered
1 Star
Used product delivered
There were scribblings on the book from someone who used it before and it’s barely user friendly to read with those scribblings present
Thank you for your feedback
Sorry, there was an error
Sorry we couldn't load the review

Top reviews from the United States

Reviewed in the United States on September 25, 2001
Many years ago, I began to feel that the power of templates in C++ has not been fully exploited. In more recent years, the emergence of the STL has shown that templates can be used to great advantage for containers, allowing conceptually simple generic implementations to be reused in a wide variety of situations, with no run-time penalty. This advance only increased my sense that we haven't yet seen the full power of templates.
Alexandrescue's remarkable work is, in my view, the most original and important advance in C++ since the STL. It has been an article of faith in the design patterns community that one can't implement a reusable design patterns library in any language, because each pattern has dozens of important variations, and an unlimited number of custom variations, all seemingly interdependent. Alexandrescue's work seriously challenges this assumption. He uses "policy classes" (explained in Chapter 1) together with many innovative template techniques to pull apart these interdependencies. The heart of the book describes in detail how he developed the "Loki" library containing many gang-of-four design pattern implementations. Loki's SmartPtr, one of the high points of the book, puts to shame the Standard C++ auto_ptr, which has been the state of the art until now.
Even before Alexandrescue's work, templates provided C++ programmers with major advantages not available in "more modern" object-oriented languages such as Java and C#. Alexandrescue multiplies the existing advantages many times, facilitating dramatic increases in C++ programming productivity and quality. Isn't that what high-level language programming is all about?
The only negative comment I have is not really a criticism of Alexandrescue's work, but of the deplorable state of C++ compiler implementations. Because many C++ compilers, especially the most popular ones, still do not fully support Standard C++, many of Alexandrescue's techniques cannot yet be used in many practical situations. I would like to think that the importance of supporting Alexandrescue's library will motivate compiler vendors to make the necessary, and long-overdue upgrades.
20 people found this helpful
Report
Reviewed in the United States on July 26, 2013
I remember reading this book for the first time about 7 yeas ago and feeling my head turn inside out. Upon re-reading it recently I found it exciting and very understandable. The techniques outlined in this book solve problems that no other techniques can resolve. I find it amazing what can be done with classes and functions that never even get constructed.

Definitely gives a good coverage for all aspects of Meta Programming I think one of the measures of respect by which this book is regarded is how many of these pioneering techniques have made It into the Boost library.

Thoroughly recommended for the intermediate to advanced programmer to have in his library. Even if you don't use C++.
3 people found this helpful
Report
Reviewed in the United States on March 8, 2005
First of all, i don't understand why so many ppl complaining that the book talks too much about template. The title says generic programming; even you are so genius that you find other way to accomplish generic programming, I'm sure all the concept still apply.

I'm really happy i read a review from Gamma's pattern (very good, but very dry, takes years to digest) book and pointed me to this book. It teaches you how to implement pattern using generic way. As an engineer(not computer science), I found the book answered a lot of question and probelm that I wasn't be able to deal with practically.

Here are the list that you can learn from this book,

1. ever wonder how to write library like boost.org, read this book

2. ever wonder how can you create a object with the same type of another object(or some type) without knowing the type, read this book

3. don't want to implement pattern yourself or don't want to hard code the pattern, ex. object factory, then just download the code. VC,BC&GCC are supported

Masterpiece.
6 people found this helpful
Report
Reviewed in the United States on November 25, 2010
The material presented in this book is mainly for library writers and senior developers who are in charge of software design. Having said that, the material here is unlike you'll find in any other book. Author discusses design and implementation of reusable components like a (very sophisticated) singleton, visitor, generalized functors, smart pointers, etc. I found discussions on smart pointers and singleton to be particularly enlightening. Its amazing how a simple design pattern like singleton could have so many intricacies.
But the chapter which blew me away was that of typelists, and what author achieves by using simple metaprogramming constructs (although I would be the first one to admit that a mere mortal software developer like myself would not be using typelists everyday, but its still fun to learn about them).

This book is very different from whatever material I had read earlier on C++. Do read this book once you are familiar with topics like templates, common design patterns and smart pointers.
13 people found this helpful
Report
Reviewed in the United States on February 15, 2013
Never has a professional/technical book made such an impact on me.
I've had this book for many years,but decided to write this review only now because after so many years the pearls of this beautiful masterpiece are unfolding to me. If I love C++ it is because of Andrei Alexandrescu and his amazing book. I only wish that he would write some more books like this. If you find this book to be scary at first and hard to understand, I would like to encourage you to keep on reading and trying. You'll get it eventually and once you do, there is no way back :)
4 people found this helpful
Report

Top reviews from other countries

truth-seeker
5.0 out of 5 stars Nothing to say, just love the book if your into C++
Reviewed in Germany on January 25, 2023
Nothing to say, just love the book if your into C++
krishna kumar thakur
5.0 out of 5 stars Must read, reread and read again.
Reviewed in India on June 24, 2019
One of the best c++ book. Though its not suitable for begineers but if someone really want to know template, its for them. It require you have some idea on template, but you'll find yourself thinking in templates. Genious template tricks. If read carefully you'll learn design, best c++ practice, and patterns. Just get template idea before reading this book. Andrie is genious.
One person found this helpful
Report
A m a z o n Customer Ian
5.0 out of 5 stars A modern development in the use of ISO C++ on how to produce more effective libraries.
Reviewed in the United Kingdom on July 9, 2017
1st Indian subcontinent 2007 edition, 2017 printing. For ISO C++98 standard so not compatible with MS Visual Studio/C++ 6 or 7.
The author describes his free multi-threading library, Loki where the textual errors have been removed.
This is a modern development of C++ by using templates and macros to improve the speed at runtime.
The macro processor is a completely programmable Turing machine so the templates can be executed statically at compile saving the time to do this dynamically at runtime.
These methods are only usable with ISO conformant C++ compilers so it is not much use for other languages except perhaps the D language.
There is a description of how to implement singleton, command, object factories, Abstract Factory and Visitor design patterns using policies, traits and typelists.
The author since about 2010 became a lead developer of the D language.
Ayon Md Farhabi Helal
5.0 out of 5 stars Didn’t expect much but Surprised by the Quality
Reviewed in Japan on October 26, 2019
I wanted some books to review my C++ skills and suddenly found out this deal. The price was in such a sweet spot that I couldn’t ignore it. To be honest, I was not expecting much. Anything readable would be acceptable for me. But I was amazed when I got it in my hands. The book was in a great condition for its price. I would love to buy again from them.
One person found this helpful
Report
Onorato Vaticone
5.0 out of 5 stars A must-read book!
Reviewed in Italy on May 17, 2014
You really have to read this book! It's much more than "modern C++ design".
. . . . . .
One person found this helpful
Report