GetTextbooks.com  
 Compare Prices & Save up to 90%
Search by ISBN, title, author, etc ...

Login | Sign up | My Wish List  


Modern C++ Design: Generic Programming and Design Patterns Applied (C++ In-Depth Series)

by Andrei Alexandrescu

ISBN-10: 9780201704310
ISBN-10: 0-201-70431-5
ISBN-13: 9780201704310
ISBN-13: 978-0-201-70431-0
Paperback
2001-02-23
Addison-Wesley Professional


Find Lowest Price

Reviews


Seminal book
I do not know what to call this magnificent work. An work of art or excellence by Mr Alexandrescu. It is great book, only for typelists chapter, it is worthed to buy. I have no hesitation to recommend to the one who want to learn modern C++ techniques.

Enter the World of Metaprogramming
Although this book is now six-plus years old, compilers have finally caught up with the implementation allowing the techniques outlined in the book to be used in production code. Alexandrescu infuses what could be a dry topic with humor, and does a great job of explaining fairly esoteric ideas with enough grounding in concrete implementation to be approachable by a wide range of readers.

The book does a great job of outlining factory classes, which are often given a hand-waving description with no explanation of how to deal with the 'start up' problem of populating the factory with the set of classes it should be creating. This usually leads to lots of boiler-plate, hard-coded linkage between different pieces of the system, but Alexandrescu outlines techniques to automate this process.

If you have been chafing at some of the restrictions imposed by the C++ standard after being exposed to more dynamics languages like Objective C, Ruby, etc., you may find a few tricks that will enable you to achieve your goals.

Great book with an important caveat
That caveat being: the book is not of immediate _practical_ value to most C++ programmers (other than as a brain teaser or inspiration, both of which are of course very important). Let me explain. The book is 5-star material but its audience is rather specific. Most of the techniques described in it are useful to _template libraries_ designers only. For others these techniques would fall into the "vastly overly clever" category. In real life such cleverness is a serious impediment and a maintenance nightmare as every manager knows. A template library programmer, however, can benefit tremendously from this book since template libraries must be very clever and tricky indeed.
One more note: earlier printings of this book had many mistakes in it (including the code) so I'd recommend buying a new printing - or else arm yourself with a pen and plenty of time to hand-insert all the errata from the book's web site.

Interesting; over-complex
This book is mostly about what you COULD do with templates, but IMO probably wouldn't want to. The Loki library that it describes provides some uber-generic components using a lot of template meta-programming, but it's unclear if that's a good trade-off. You gain a small amount of code reuse (you don't have to write a singleton yourself, for example), but God help you if anything goes wrong, and you have to debug these things.

Great techniques, not for the normal programmer
Finally I picked up "modern C++ design". It was on my list for a long time. Last years I've been diving more in Java, Groovy, Ruby and other languages. So, this book was back to C++ for me.

I found the book well written, even almost funny at times. The code was clear and it was all easy to understand for me. So, well done since it's always difficult to explain fairly advanced concepts in simple language.

The book consists of 2 parts. The first part describes concepts like policy-based design and typelists. I liked the concept parts and this was my first encounter with typelists, thus I was quite amazed.

The second part of the book describes how to design generic patterns. I liked them, however, I felt that making some of these patterns generic is not really worth it. The amount of duplicate code removed, is not very high. The complexity added by the generic implementation, however is high.

An example is chapter 7, smart pointers. I've designed some libraries in the past and as library designer we agreed on 3 different types of smart pointers. We write three different classes and that's it. Is it worth making a generic implementation which can cover all of these three types. In my opinion, no. However, as an exercise of what you can all do with templates in C++, it was very interesting!

I'm now and then working with developers who develop in C++. They already struggle with the complexity of the language, the environment and the tools. Giving them generic programming in C++, would probably increase their struggle and wouldn't really gain much. Maybe a new language need to be created with better generic programming support instead?

Anyways, for any C++ fanatic or programming fanatic, this is a fantastic book. For "the normal developer" it's probably overkill.


Home | Browse | Professors | Merchants | Webmasters | Contact Us

[ Canada | United Kingdom ]

Copyright © 2003-2008 GetTextbooks.com