Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Web Development

Programmer's Bookshelf Newsletter - April 2005


Dr. Dobb's Programmer's Bookshelf Newsletter

Book Reviews

Imperfect C++

Reviewed by Bjorn Karlsson

In Imperfect C++: Practical Solutions for Real-Life Programming, Matthew Wilson presents a guided tour of contemporary C++. Geared toward practicing programmers, the book has a particular focus on handling situations that arise in the real world. It is this property that sets Imperfect C++ apart from other such books: Wilson skillfully attacks problems that you'll eventually have to deal with when writing software.

Part I of the book covers the fundamentals: Why RAII is important, how contract programming helps build reliable software, and explains wrapper types, value types, and the like. Because this section sets the table for the rest of Imperfect C++, you'll probably read it fairly quickly. I admit to skimming through this part of the book, because it jumped between topics without really providing new details not found elsewhere.

Part II is filled with problems and solutions that arise in real-world programming. It includes chapters on how to deal with C++'s lack of a standard Application Binary Interface (ABI), dynamic libraries on different platforms, threading issues, and static functions/data (including an excellent display of popular Singleton types).

Part III focuses on language issues, such as the lack of fixed-size integer types, the missing dimensionof operator, the inability to distinguish between pointers and arrays, the lack of a NULL keyword, the perils of bool, and other issues that have caused Wilson (and most other C++ programmers) grief. Also, Wilson presents his views on class layout and how to write proper if statements. While I don't agree with all of the items, I do take my hat off for him having the courage to argue for them. Feel free to flame him!

Part IV tackles conversions, and introduces the concepts of Casts, Shims, Veneers, and Bolt-ins. This is arguably the most innovative part of Imperfect C++--and it is great. Shims are simple in concept. They're another level of indirection for accessing (possibly unrelated) types, allowing for consistent coding and empowering generic code. Wilson defines several types of shims: Attribute Shims, Control Shims, Conversion Shims, and several composite shims formed using these basic ones. Veneers are used to add functionality (through inheritance of its parameterizing type) to other types, with the restrictions that it may not add virtual functions or nonstatic member variables. Bolt-ins are similar to veneers, but may substantially change the semantics of their parameterizing types.

Part V is devoted to C++ operators, with enlightening chapters on correctly handling Boolean conversions, how to use operator overloading for fast string concatenation, and why some operators shouldn't be overloaded at all.

Finally, Part VI picks up the pace through C++ extensions through class libraries. This is a great exposition of clever techniques and useful tools. Especially interesting are chapters on ranges (which are far more important than simply relieving you from the repetitious tedium of writing begin()/end() all over the place) and on implementing support for properties in C++. I also enjoyed the chapter on multidimensional arrays.

Imperfect C++ covers a lot of C++ ground, and the tempo is often challenging--so stay alert!

You will also need to be fairly proficient in C++ to get the most out of the book, as basic concepts are only briefly mentioned. I do have a couple of issues with this book, and one is the title. While Wilson is often exposing flaws in the language, these imperfections are not the main attractions: This book is really about celebrating and exploring the virtues of C++. The other issue is that Wilson sometimes leaves you wanting more detail on mind-boggling techniques or compiler quirks, making me hope that he's already at work on "More" Imperfect C++. However, these are minor issues, and I highly recommend this book to serious C++ programmers. It is jam-packed with important lessons that are taught in a pedagogic manner. An especially sympathetic property of this work is the way Wilson always stays close and personal to the reader. The book is also funny--and considering that Wilson is from Yorkshire, I find this especially astounding. Finding computer literature with humor that is actually funny is a rare treat.

Imperfect C++: Practical Solutions for Real-Life Programming
Matthew Wilson
Addison-Wesley Professional, 2004
624 pp., $44.99
ISBN 0321228774

Bjorn is author of the upcoming book Beyond the C++ Standard Library: An Introduction to Boost.

Pragmatic Project Automation

Reviewed by Miles Thiabault

At my first programming job, I asked a coworker if it was a pain to type in all his test data all the time. He showed me a couple of CSV (Comma-Separated Values) files and a Perl script and said "I only type once." I thought it was a great idea, but only used it myself sporadically in the years since.

Mike Clark's Pragmatic Project Automation is about taking that idea to its most useful extreme. The book is the third volume in the Pragmatic Starter kit, but is self-contained enough that it can be read on its own. The first chapter starts with a story about how build automation makes everyone's life better--especially the developer's. That's really what this book is about--letting the computer do boring, repetitive things so that we can concentrate on what's new and interesting.

The rest of the first chapter answers some frequently asked questions including why and when developers should automate. This FAQ is useful in its own right, but also helps readers figure out whether the rest of the book is for them.

The next two chapters show how to automate a Java build with Ant and then schedule that build. At first, I wondered how this would help me, since I'm doing web development with Python right now and don't usually compile Python. Then Clark pointed out that running tests is part of the build process. A day later, my build process consisted of checking out Python files from version control and running all my unit tests on them.

Chapters 4 and 5 describe how to generate and distribute releases of software. One of my favorite ideas from these chapters is writing a checklist script that clients can run on-site to check for "is it plugged in" errors.

The last chapter is about monitoring all this automation. In my mind, this chapter alone is worth the price of the book. Developers always want this information, but no one enjoys being spammed by their own computers, and it's a pain to set up filters so that the right messages reach exactly the right people. Clark's solution? Use RSS notifications so that your build system creates a blog as it goes along. It's a great idea, and I've already started implementing it locally.

Pragmatic Project Automation is short, but it's chock full of ideas and advice that can be put to use immediately. I found Clark's writing style clear, easy to read, and often entertaining. As a bonus, the book's concepts are language independent: Clark uses Java and Java-based tools, but I had no problems applying everything to Python. The book also has excellent support with its own web site and the authors' web log.

Pragmatic Project Automation: How to Build, Deploy, and Monitor Java Apps
Mike Clark
Pragmatic Programmers, 2004
176 pp., $29.95
ISBN 0974514039

Miles Thiabault is a software developer and computer science student at the University of Toronto.

Perl Core Language

Reviewed by Jack J. Woehr

Perl Core Language is part of Paraglyph's "Little Black Book" series, billed as "concise problem solvers." The content of Perl Core Language consists primarily of chapters in two parts. The first part of each chapter is the In Brief section (it might simply have been called "Brief"), a summary of the theme that unifies the chapter. This is followed by Immediate Solutions, topics (often occupying less than a full page), such as "Removing Trailing and Leading Spaces," "Using Array References as Hash References," or covering one of the scores of Perl function calls described by the book.

The book takes you from the basic language up through object Perl, Modules, CGI, XML, and Perl Debugging. The industry ritual of two "on beyond zebra" chapters at the end goes unchallenged: Here the extras are Chapter 20 on counters, guestbooks, e-mailers, and secure scripts; and Chapter 21 on multiuser chat, cookies, and games.

Though it starts with a Chapter on "Essential Perl" covering the boilerplate topics of downloading and installing Perl, making sure the shell interpreter can execute your scripts on any conceivable platform, language basics, and so on, Perl Core Language is not a book for learning Perl (nor for learning XML--you should be well grounded before you tackle Chapter 19, "Perl and XML"). It's a book for those who have learned Perl, and probably umpteen other languages, which explains why they need such a book open on their desk as they dive into a Perl project or merely into a day's coding. The book is the digested manual, often paired with clarifying examples composed by a skilled exigete for application on the fly. Hundreds of useful (albeit shallow) headings fit into a book under the application of such a formula, but the concision comes at a price. Holzner gets into the rhythm of his formula to the extent that, occasionally, he appears not to have parsed what he was writing for sense, as in the sprintf article:

    %e - A floating-point number, in scientific notation
    %E - Like %e, but using an uppercase E.
    %f - A floating-point number, in fixed decimal notation.
    %g - A floating-point number, in %e or %f notation.
    %G - Like %g, but with an uppercase G.

In case you missed the error, read the %G line again. %G most definitely does not produce an "uppercase G" in its output.

Perl Core Language is another one of these books whose blurbs reference Perl 6.0 ("[C]overs the current version—as well as highlighting critical features of the upcoming 6.0 version"). Anyone following the developers' list for Perl 6 ([email protected] or in entertaining the weekly summary) knows that if you want to know about Perl 6, you start at http://dev.perl.org/perl6/. If you don't understand what you read there, you don't really want to know right now, anyway. In any case, for the target reader of Perl Core Language, the contours of Perl 6 can be most usefully summed up by the Magic 8-Ball: "Ask again later."

Certain other literary aspects of the work rub this reviewer the wrong way. First of all, prolific author Steven Holzner is an old hand at tech writing. Amazon offers 96 (!) of his books. Yet, oddly enough, none of these previous authorships are listed in this book under the "About the Author" heading. Second, we're sure Holzner wouldn't program a new object class merely to encapsulate one-to-one the capabilities of an extant class. Then why are the "Acknowledgments" solely aimed at the book's production team? Shouldn't the roles played by these individuals simply appear de rigeur inserted into the book by the publisher as "Credits" without reference to the author's wishes? Normative these days in tech book "Acknowledgments" are frank comments like, "I could never have done it without my wife Hroswitha, who entered therapy so she could handle my locking myself in my basement office for two years to write this book for a $7000 advance against nonexistent royalties." Now, if Holzner had offered praise to these individuals for doing their jobs skillfully despite their being woefully underpaid and abused by seven layers of lackluster management or something of the sort, there would be the kind of value added above and beyond simple credits that would justify calling it an "Acknowledgment."

The web site turns out to be a tumble-down shed since the new barn got raised: http://paraglyph.oreilly.com/. There, you'll find the link to Perl Core Language pointing to http://www.oreilly.com/catalog/1932111921/. Hardly an intuitive URL, but consolidation marches onward in tech book publishing as in all other industries. Anyway, once arrived at the cited URL, you will find none of the usual amenities: no table of contents, no sample chapter, no downloadable example code. Everything about this effort bespeaks itself of hurry, which is hardly unusual hereabouts, but rush reaches an apogee in the present case wherein the same author publishes several other books in the course of the same 12 months. Steven Holzner clearly understands Perl, has impressive authorship credits, and is approaching rough parity with Herbert Schildt, another workhorse of this industry. If only Holzner, at the peak of his form, had time to stop and smell the roses!

Perl Core Language, Second Edition
Steven Holzner
Paraglyph Press, 2004
528 pp., $29.99
ISBN 1932111921

Jack J. Woehr is an independent consultant and team mentor practicing in Colorado.


Recent Releases

Jakarta Commons Online Bookshelf
Vikram Goyal
Manning, 2005
PDF e-book,402 pp., $39.95
Individual Modules, $4.00 to $7.00 each
ISBN 1932394524

Jakarta Commons is a collection of open-source Java components broadly ranging from logging, validation, bean utilities and XML parsing. Written for developers and architects, the Jakarta Commons Online Bookshelf is an electronic collection of fourteen modules covering the most popular Commons components. Readers can quickly and easily learn to incorporate the right components into their existing Java applications, avoiding countless hours writing thousands of lines of code.

Linux Quick Fix Notebook
Peter Harrison
Prentice Hall PTR, 2005
651 pp., $39.99
ISBN 0131861506

If you're responsible for delivering results with Linux, this book promises to bring together all the step-by-step instructions, precise configuration commands, and real-world guidance you need.

Firefox and Thunderbird Garage
Chris Hofmann, Marcia Knous, and John Hedtke
Prentice Hall PTR, 2005
384 pp., $24.99
ISBN 0131870041

Enter the Firefox and Thunderbird Garage, where you'll learn to master the free software that's helping millions of people use the Web and email faster, more efficiently, and more safely.

Inescapable Data: Harnessing the Power of Convergence
Chris Stakutis and John Webster
IBM Press, 2005
304 pp., $29.99
ISBN 0131852159

As communications, computing, and data storage converge, data is becoming utterly ubiquitous...and that changes everything. In this book, two leading data management visionaries reveal how data transforms the way you do business, the technologies you use, the investments you make, the life you live, and the world you live in.

Cascading Style Sheets: Designing for the Web
Hakon Wium Lie and Bert Bos

Addison-Wesley Professional, 2005
416 pp., $44.99
ISBN 0321193121

Direct from the creators of CSS, this is the definitive reference to CSS 2.1, a standard for controlling the appearance of any Web or XML document. This book carefully explains the "why" behind today's most valuable CSS design techniques. You'll find practical, downloadable examples throughout--along with essential browser support information and best practices for building high-impact pages and applications.

Available Soon

Silence on the Wire: A Field Guide to Passive Reconnaissance and Indirect Attacks
Michal Zalewski
No Starch Press, 2005
312 pp., $39.95 ISBN 1593270461

The much anticipated first book by computer security researcher Michal Zalewski, Silence on the Wire: A Field Guide to Passive Reconnaissance and Indirect Attacks promises to be unlike anything else out there: It is a narrative that explores a variety of unique, uncommon, and often quite elegant security challenges that defy classification and eschew the traditional attacker-victim model.


Contact Us

To contact Dr. Dobb's Programmer's Bookshelf Newsletter, send e-mail to Deirdre Blake, DDJ Managing Editor, at [email protected].

All content copyright 2005, CMP Media LLC.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.