AnyBook4Less.com | Order from a Major Online Bookstore |
![]() |
Home |  Store List |  FAQ |  Contact Us |   | ||
Ultimate Book Price Comparison Engine Save Your Time And Money |
![]() |
Title: Modern C++ Design: Generic Programming and Design Patterns Applied by Andrei Alexandrescu ISBN: 0-201-70431-5 Publisher: Addison-Wesley Professional Pub. Date: 13 February, 2001 Format: Paperback Volumes: 1 List Price(USD): $44.99 |
Average Customer Rating: 4.46 (48 reviews)
Rating: 4
Summary: template pathology
Comment: Read this book and you may feel you've fallen down the hole into some sort of C++ Alice-in-Wonderland:
"Isn't it nifty just how much you can do with functions... that not only don't do anything but don't even really exist at all?" p.36
The title is a bit presumptuous; a more accurate title would be "Template Metaprogramming Stunts", since this book is primarily about tricks you can play with C++'s template mechanism.
The author does also make a go at proposing a new concept of "policy-based class design" -- by which he means using templates intead of multiple inheritance to create combinatorial mixtures of behavior. This is interesting, but seems hard to apply beyond the cliches he considers (ex: smart pointers), so his argument reads like a well-intended but parochial graduate thesis, with dutiful gestures of respect to his mentors (ex: Scot Myers) and limited range of real-world application.
The real meat of the book is his template techniques, which are ingenious -- if perverse, when seen from the standpoint of someone else trying to read and extend your code, or diagnose its arcane compiler errors. If you've ever had to work with other people on software, you may find his glib view of compiler errors disappointing. In many cases he relies on compiler errors to signal something more complex and semantic than the mere error would suggest. (If you're programmed much C++ you've surely experienced 10-line long STL template errors with a very simple underlying cause that is hard to discern from the error message. Learning to suss out what these mean is much of the sweat-work of learning C++.) I think this is simply that he's coming from the perspective that the interworkings of the language and the compiler are fascinating, and worth being a primary focus of study. But from the perspective of someone just tried to get your work done in the problem domain at hand, you may resent this attitude.
This book is best approached if you think C++ is really neat. Wheter you love C++ for its roccoco intricacy, or just see it as an evolutionary leaf node language full of botched misfeatures, you will find much here to confirm your opinion. I don't mean to belittle this book. There is real insight here: the idea of computing on types instead of values (to store the results of template-based computations) is a nifty idea. But it's worth keeping an eye on what problems you are really trying to solve, and which ones you may be creating.
Some telling quotes:
"Unfortunately, type_info's useful capabilities are packaged in a way that makes them unnecessarily hard to exploit." p.38
"For a variety of reasons, C++ is a language that leads its users sometimes to say, 'These are the smartest five lines of code I ever wrote.' Maybe it is its semantic richness or the ever-exciting (and surprising?) way its features interact." p.51
Rating: 5
Summary: An instant classic
Comment: This is a concise but very informative book about the powerful features of C++ and how to use them. This book covers some of the same areas as the "Generative Programming" book, and then some. In particular, the chapter on Typelists provides a powerful demonstration of the compile-time functional programming style afforded by the C++ template system. There is also an extensive coverage of how to implement some of the classic GoF patterns -- Command, Singleton, Factory, AbstractFactory, Visitor -- and, more importantly, covers the various trade-offs involved. Finally, it demonstrates the power of Policy-based template classes in expressing these trade-offs in code.
Being a conscientious reviewer, let me also point ot a few problems. It is somewhat startling that Addison-Wesley has done such a bad job about producing such an useful book. There definitely is a feel that the book has been rushed to print. There are many obvious errors that any competent copy-editor would have caught and fixed. Typos abound. Names are inconsistent -- for example in one paragraph the same class is called both 'Singleton' and 'SingletonHolder'. The flow is sometimes somewhat jarring -- for example, in the discussion about smart pointers, and using the 'SmartPtr<...> sp; if (sp)' construct -- one paragraph essentially says there's no safe way to do this, "end of story", and then immediately after that presents a technique to implement this, as far as I could make out, safely. Another small distraction is that the fixed-width font used for presenting the code uses a 'fi' ligature (i.e., the two letters 'fi' take up the space of one letter) -- a simple error that should have been caught. All these make the reading experience somewhat less pleasant than it should be.
However, these detract little from my overall opinion of the book. This book belongs on your bookshelf.
Rating: 3
Summary: Good book but..
Comment: I have to say that this is indeed a good book but it as it share of problems.
The chapter about type list is good, the functor is very good and its multimethods is greate. The reset is between nice to poor. Is implemention of singleton is simply poor programming in both design and implemetion. He seem to fall to any trap posible on the way to impelementing it. The small object allocator is also very poor. The object factory is redandnet as the impemention is C++ is very trivial. The first 2 chapers are nice but if you into template there are other books much better then this (and this book don't intend to teach you about it anyway). The smart pointer is also more of a techenics that you may consider - if you want good staff about it then go to boost.org . There are better code about this staff and others anyway. Anther problem is that he seem to come from the windows world and so Loki would not work on any other platfrom without you writing the code to port it - Anyway is design of multithreading is anther shortcoming. This book is good mainly - like the design pattern book - for some insites and idias, other then that the book is of very limiting use in the real world as it trys to solve problems that he cannot solve (unless you design your code around it and not the other way around). I have to say that when I first read the book is seem like its something great and new, but once I read more into this subject in other books and on the internet I found that its not that greate as it seem from the first impartation. Last point is that its coding style seem very poor (At least to me). It reminded me the way I used to write when I first started to program (using pSomething to point that the variable is a pointer..) He should have uses style similer to what is commenly used in other books (like the C++ programming laguage book). If you into design then Multi-Paradigm Design for C++ is better, and if you into template then "C++ templates" is much better.
![]() |
Title: C++ Templates: The Complete Guide by David Vandevoorde, Nicolai M. Josuttis ISBN: 0201734842 Publisher: Addison-Wesley Pub Co Pub. Date: 12 November, 2002 List Price(USD): $59.99 |
![]() |
Title: Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library by Scott Meyers ISBN: 0201749629 Publisher: Addison-Wesley Professional Pub. Date: 06 June, 2001 List Price(USD): $39.99 |
![]() |
Title: Exceptional C++: 47 Engineering Puzzles, Programming Problems, and Solutions by Herb Sutter ISBN: 0201615622 Publisher: Addison-Wesley Professional Pub. Date: 01 November, 1999 List Price(USD): $37.99 |
![]() |
Title: More Exceptional C++ by Herb Sutter ISBN: 020170434X Publisher: Addison-Wesley Professional Pub. Date: 17 December, 2001 List Price(USD): $37.99 |
![]() |
Title: The C++ Standard Library: A Tutorial and Reference by Nicolai M. Josuttis ISBN: 0201379260 Publisher: Addison-Wesley Professional Pub. Date: 12 August, 1999 List Price(USD): $59.99 |
Thank you for visiting www.AnyBook4Less.com and enjoy your savings!
Copyright� 2001-2021 Send your comments