Skip to content
Paperback Modern C++ Design: Generic Programming and Design Patterns Applied Book

ISBN: 0201704315

ISBN13: 9780201704310

Modern C++ Design: Generic Programming and Design Patterns Applied

Select Format

Select Condition ThriftBooks Help Icon

Recommended

Format: Paperback

Condition: Good

$16.79
Save $48.20!
List Price $64.99
Almost Gone, Only 1 Left!

Book Overview

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...

Customer Reviews

5 ratings

Template metaprogramming on crack

Simply put, this is one of the best C++ books I have come across. It will open your eyes to what generic programming really is and how it can be done with C++.As another review states, "this book is mostly about templates". Certainly true. This book takes templates where few have dared venture. Rather than use templates as a glorifed macro system, Alexandrescu uses templates to define small code generation engines. Your knowledge of C++ will most certainly be expanded, but you'll also come away from this book with a different way of looking at programming problems.The book also picks apart many popular design patterns and shows how to implement them in very generic ways. Alexandrescu's treatment of certain patterns is so thorough that you'll understand the pattern better from this book than the original.Perhaps the techniques go too far, perhaps there is a limit to how generic one should go. That is yours to decide, but this book is definitely a keeper for the C++/software development bookshelf.

Read this milestone book!

I highly recommended this book if you are interested in generic techniques and Design PatternsThis book uses C++ and Generic programming techniques to implement GoF Design Patterns [1]. It introduces Andrei's "Generic Design Patterns Library", called "Loki". Loki's techniques are more important than the library itself and should be applicable in many other contexts. (Since the library is not yet available, I cannot comment on it further.) One word of caution (lest you get overly excited) - Loki uses some of the latest C++ features and requires standard-adhering compilers [g++ v2.95.2-5, Borland C++ v5.5, and EDG's v2.45 or later. Microsoft's VC++ 6.0 fails-Ed.]The book is written for intermediate or expert level programmers. A fair knowledge of C++, particularly templates, is needed Also, some knowledge of Design Patterns is useful, although not strictly necessary, since the book describes the patterns in a pretty self-contained fashion.With these prerequisites the book makes for quite an enjoyable read, but I would not call it easy due to the inherently complexity of the material covered. Andrei's writing style is frank and friendly, which makes the reading easier.I found the code fragments to be very accurate bar some mechanical/typesetting errors, some of which will be fixed by the time of the printing. The book's strong points include:1) Taking techniques as complex as template meta-programming and bringing them back to us earthly beings. You could get a more extensive treatment of these techniques from the book Generative Programming [2] or from Todd Veldhuisen's papers [3] but the examples in this book make a very good introduction to the area.2) Creating a generic library of design patterns using "policy-based" classes eliminate the redundancy found in many systems that utilize Design Patterns.3) The one line of the book I'd like to (mis?)quote in my review is "Remember, the design constraints buried in the class's design are as bad as magic constants embedded in code". As obvious as it is, this principle is often overlooked (I know...) and largely because people do not see a solution to it and are willing to live with the "this is as good as it gets" mentality. In this sense the book was a great eye-opener - it showed the feasibility of the solutions and the techniques for the implementation.Personally, I hope you enjoy the book as much as I did!

An Essential C++ Book

First came type-safe containers and generic algorithms, and then came traits. Now, thanks to Andrei Alexandrescu's ground breaking new book "Modern C++ Design," we have policies. Policies provide a means of creating very flexible and extendable libraries with little to no run-time overhead.As an example consider the Singleton pattern. What is the lifetime of the singleton? Should it be destroyed? If so, when? What, if any, threading model should the used by the singleton? Unfortunately, there is no one best answer. The good news is that policies allow the application developer to choose the answer that best fits their needs. Several policies are presented in the book but best of all is the fact that if none of the policies are well suited to the problem at hand, it is remarkably easy to write a new policy that plugs into the library.While it may be tempting to write an entire book on singletons, the book covers a myriad of other topics, including but not limited to, smart pointers, object factories, abstract factories, visitors, and a memory allocator optimized for small objects. Each topic is covered thoroughly and is easy to read and understand. Be forwarded however, the reader must have of strong understanding of C++ template fundamentals. This is not an introductory tutorial on templates.There are a number of books that should be considered "must have" for all professional C++ programmers and designers. These books include Scott Meyers' "Effective C++" and "More Effective C++", Herb Sutter's "Exceptional C++", and the "Gang of Four's" "Design Patterns." "Modern C++ Design" is the newest addition to this list.

After two disappointments...

I was longing for a good book on advanced C++. First, I bought "Multi-Paradigm C++". It does have some insights but author's style is baroque to the extreme. A good cure for insomnia. Then I bought "Generative Programming". I found it too much of a PhD thesis garnished with too much fluff for my taste.Not wanting to risk anymore, I borrowed this book from a friend... to lose sleep for two nights reading it! It is the book I was looking for: no-nonsense, eye-opening, inspirational. The author's mastery of C++ and the creativity with which he solves real-world problems are phenomenal. Alexandrescu discusses and implements the following design patterns: Command, Singleton, Proxy (in the form of smart pointers), Factory Method, Abstract Factory, and Visitor. In doing so, he creates highly configurable components that support most variations that accompany the patterns, and allow the component users to add their own variations. This is done through template parameters. The technique is not new but the author documents it thoroughly (coining the Policy-based design term) and uses it very creatively to achieve elegant designs.The book also has foundation chapters: Techniques, Typelists, and a small object allocator. The latter is not really in sync with the rest of the book, being a low-level component written in straight C++, but in compensation, the chapter on typelists is as meta as you can imagine, and more :-).In short: a great book if you use C++, especially so if you need to participate in the architectural stage of projects. But the best thing the book has done for me is, it made me extremely excited about programming - a feeling forgotten since my college days. Five stars plus.

A significant and valuable book; strongly recommended.

I was waiting for this, and pestering bookstores for it for 2 weeks before it arrived. And it still exceeded my expectations. Note: The author was partly responsible for the C++ ScopeGuard library - an amazing, essential piece of code.For any C++ engineers using reference counting (that'll be all of us, then), the amazingly configurable SmartPtr and the SmallObjectAllocator are instantly worth many times the price of the book. The deep, thorough analysis of Singletons, Functors, the Visitor pattern, Double-dispatch and Factories are all important chapters in their own right, with immediate use in real programs as well as educational value. The pervading concept of policy classes will undoubtedly influence your future approach to design, because the examples are all so elegant, compelling and downright useful. But I think there is even more value in the longer term. This book takes a somewhat dizzying step into a new way of thinking, reminiscent of first encountering STL or GoF's Design Patterns. I feel sure that the concept of typelists is an important contribution to the direction of the language; a flexible, generic, *declarative* way of expressing relationships between abstractions. However, these techniques place such strain on the C++ template facility (which even in its final ISO form is barely adequate for the task) that it's amazing that they work at all. The book is full of ingenious work-arounds to overcome language limitations.I just wish that more current compilers would accept the code. Sadly, Visual C++ 6.0 is a long way from this level of standard-conformance. Hopefully VC++ .NET will be better.
Copyright © 2023 Thriftbooks.com Terms of Use | Privacy Policy | Do Not Sell/Share My Personal Information | Cookie Policy | Cookie Preferences | Accessibility Statement
ThriftBooks® and the ThriftBooks® logo are registered trademarks of Thrift Books Global, LLC
GoDaddy Verified and Secured