Books in Brief
Ron Burk
Win32 Programming
Brent E. Rector and Joseph M. Newcomer
1,582 pages
Addison-Wesley Developers Press, 1997
$54.82 (includes CD-ROM)
ISBN 0-201-63492-9
A long time ago, Brent Rector wrote a book called Developing Windows 3 Applications with Microsoft SDK. I always felt it unfortunate that book received little exposure, since it was one of the few books that approached Petzolds in breadth and depth. Therefore, I was very interested to see the arrival of Win32 Programming, as it appears to be a greatly expanded and updated version of Rectors original book about Windows programming.
Rectors original book was large, and this one is huge the index alone is around 200 pages. Like Petzolds classic tome, this one starts off with a simple C-style WinMain() program to introduce the basic concepts of windows and messages. In fact, the order of topics through this book is somewhat reminiscent of Petzold. The chapter headings paint a fair picture of the scope of the book: Introduction to Windows Concepts; A Skeletal Windows Application; Exploring Variations on a Window; Displaying Text in a Window; Examining a Device Context in Depth; Graphical Output: Pixels, Lines, and Polygons; Keyboard, Mouse, and Timer Input; Using Controls: Static, Button, and Edit Classes; Using Controls: ListBox, ComboBox, ImageList, and TreeView Classes; Using Controls: Scroll Bar, Trackbar, Up/Down, and Progress Classes; Dialog Boxes; Menus, Accelerators, Icons, String Resources, and MessageTable Resources; Printing; Memory Management; Fonts; Dynamic Link Libraries; The Multiple Document Interface; and Synchronization. Thats a lot of chapters, and the chapters tend to be large and dense, making this one of the most information-packed books around on general SDK Windows programming.
As always, I first skimmed quickly to see how many errors would jump out at me. I immediately ran into the incorrect claim that, on machines for which a NULL pointer is a non-zero bit pattern, the following code would fail:
LPSTR p; // ... if(!p)
Fortunately, thats not true, and ANSI C guarantees that the expression !p correctly detects NULL pointers no matter what representation of NULL the target machine uses (but why diverge so far from the main topic of the book in the first place?). I continued to jump through the book and next found the Win32 treeview window class incorrectly identified as SysTreeView. In fact, it is SysTreeView32, and the last time I incorrectly used SysTreeView instead, the result was a nasty and baffling crash. While it wasnt difficult for me to find incorrect and incomplete information, this is quite a large book with a correspondingly large number of opportunities for errors. Overall, I estimate the accuracy of the text as fair.
One consistent problem in this book is that it is sprinkled with information that is correct only if you use Microsofts compiler. For example, the book claims that In Win32, this functionality [implib] is now part of the linker and the library manager and there is no separate program. Of course, that lack of an implib utility is pretty much unique to Visual C++ (and has nothing to do with Win32), and is the reason users of that product cannot easily create an import library from an arbitrary DLL (a problem the book fails to note). This lack of experience with non-Microsoft compilers is not just a detriment to readers who use Borland; like Richters Microsoft-centric book, this one teaches readers to create DLLs with Visual C++ that have mangled export names, making the DLLs highly inconvenient to use even with other Microsoft environments, such as Visual Basic.
Another recurring problem arises because the book tries to cover Windows 3.1, Windows 95, and Windows NT. That requires a high degree of specificity that the book was not always up to. For example, in a section on building dynamic dialogs, the text claims that a DLGTEMPLATE is always written using Unicode strings, but nowhere previously had the section announced it was presenting Win32-only information, or where the reader might obtain the correct information for 16-bit dialogs. These omissions would not confuse an experienced Windows programmer, but the book attempts to court both experienced Windows programmers and raw novices.
I think this could have been a great Windows programming book (of which there are few), but it would have required severe editing. While not padded with white space or screen shots, it has many pages that merely duplicate information (e.g., tables of window style bits) more easily accessible in the online SDK help files. A fair amount of space is devoted to one authors personal stories and programming peccadillos. The text needed better focus and organization. For example, in the chapter introducing WinMain(), an off-topic section begins with If youre just learning Windows programming, you can skip this section . . .; why on earth would anyone be reading an introduction to WinMain() if they werent just learning Windows? Present here are the usual flaws of Windows programming books: inability to select and stick to a limited topic, failure to define and consistently address a limited audience, and a general lack of writing discipline.
The accompanying CD-ROM contains a large amount of code, much of it written using MFC (though the code fragments in the book are mostly straight C). Much of it allows you to interactively explore features of the Windows API the sort of try-it-out program you would normally have to write yourself and then throw away. Whats really surprising about the CD-ROM is that the publisher (Addison-Wesley Developers Press) has written the most reasonable legal boilerplate for the code that Ive seen. The boilerplate first states the usual policy for replacing a defective disk and the disclaimer that you cant sue them if the code is lousy. Then instead of the usual legal torpedo giving the publisher the right to sue you if you ever make use of the code this books agreement says:
Purchasers of this book may copy the code on the disc for use in developing their own applications. If the code is used in a commercial application, an acknowledgment must be included in the following form: Segments of the code © 1997 Addison Wesley Longman. Reproduction of the contents of the disc or redistribution of the code is otherwise prohibited without the express permission of Addison Wesley Longman.
I nearly fainted not only was this legal agreement written largely in English (as opposed to the secret-decoder-ring-required legalese used in Microsoft Press books), but it actually gives me the right to make reasonable use of the code! Who would have thought we would see such an innovation putting the buyers needs ahead of the legal departments inertia before the twenty-first century? All else being equal, I would rather patronize a publisher (in this case, a division of a large publisher) with reasonable policies like this than one that sticks to the old tricks of hyping the value of, but not really selling you, the books code disk.
If Ive painted an overly negative picture of Win32 Programming, its because I had really hoped to be able to recommend this book over Petzold. I cant Petzolds Programming Windows 95 is still the best book for learning the basic Windows API in C. However, this book would be my second recommendation. It is one of the largest collections of fundamental Windows programming information Ive seen, and represents a significant accomplishment for both its authors. I hope this book will find its audience and not get overlooked as Rectors original work did. For beginning Windows programmers, or for working Windows programmers wanting extra reference material on a variety of basic Windows programming tasks, this is a good choice to put on your shelf when you already own Petzold.
Ruminations on C++
Andrew Koenig and Barbara Moo
380 pages
Addison-Wesley, 1997
$29.00
ISBN 0-201-42339-1
When I started learning C++, the books I read on writing object-oriented code always left me enthusiastic right up until I started pounding out code. Then I would start hitting snags. Information I wanted to hide would leak out as I ran into needs unanticipated during design. Code I wanted to be flexible and extendible hardened like concrete drying in the sun, and I would start projects over until I was sick of them. Design is something you can only learn by doing, but you can accelerate the process by studying examples of good design and the thought processes that led to them. In the early days of C++, few books provided much in the way of useful design examples. Nowadays, there are a fair number of such books, and this is one.
This book is based on the previous writings of Andrew Koenig, compiled and edited by Barbara Moo. Unless you have all the back issues of C++ Report and the Journal of Object-Oriented Programming, however, you probably havent seen much of it. Though based largely on magazine articles, the text has been revised and updated.
The text is liberally sprinkled with code fragments, but this is not principally a code book. It is a book that captures the thinking aloud of an experienced C++ programmer as he designs (and redesigns) solutions to specific, focused problems. For example, Chapter 6 examines the common design problem of handles classes that let you take advantage of value semantics without paying the price of creating distinct copies of complex objects that you pass by value. The example walks through the problem and creates a solution, one refinement at a time. The next chapter attempts to remedy shortcomings of the previous design. Design tradeoffs (what features are important and how much youd be willing to pay for them) not simplistic design maxims are the order of the day here.
You need to be an experienced C++ programmer to read this book. There is little attempt (thank goodness!) to teach the basics of the language. If youve written enough C++ classes to have created some frustrating messes, youre more than ready to read this book. Writing object-oriented code in C++ is harder than writing C code, largely because you are always solving two problems at once: the immediate problem at hand, but also the problem of structuring the code so that it will survive future requirements changes without surrendering the information you worked so hard to hide. Studying the examples and discussions in this book are one way to improve your ability to write C++ code that survives long enough to pay for itself.
C++ Gems
Stanley B. Lippman
601 pages
SIGS Books, 1996
$39.00
ISBN 0-13570581-9
C++ Report is a newsletter that evolved into a magazine, starting in the early days of C++ when few PC programmers had heard of the language. It tends to be more academic and more oriented toward language lawyer issues than the The C/C++ Users Journal, but its always been well worth reading if youre the designated C++ expert in your group. Unfortunately, unless youre able to get on the complimentary subscription list (Ive never been able to), C++ Report costs an arm and a leg. If youve never managed to cough up the money for a subscription to the magazine, the good news is that you can now buy a collection of some of the best articles that have appeared there. Former editor Stan Lippman has collected a few dozen articles from past issues and published them in this book.
Although not always as pleasantly readable as Koenig and Moos Ruminations on C++, the papers here share a focus on design issues in C++. For example, programmers often work around the fact that C++ does not directly support a virtual constructor, and this book contains two papers on the subject. Other subjects covered by the papers here include: library design, aspects of the Standard Template Library, design patterns in C++, dynamic vectors, multithreading, distributed programming, memory management, exception handling, and templates. For experienced programmers who design in C++ and whove never read C++ Report, this book is well worth the asking price.
The Essential Distributed Objects Survival Guide
Robert Orfali, Dan Harkey, and Jeri Edwards
604 pages
Wiley, 1996
$29.95
ISBN 0471-12993-3
I had passed this book over in bookstores for quite a while before the publisher sent me a review copy. The cover has a cartoon with puzzled Martians looking through a telescope at planets labeled OpenDoc, CORBA, and OLE. Some kind of warm-and-fuzzy feeling generator for quasi-technical programming managers, I figured. After a copy landed in my mailbox, I had no choice but to at least poke around the inside a bit. Apparently, that old you cant tell a book by its cover expression has some truth behind it.
This book provides a high-level introduction to the main competitors in the distributed object game: CORBA and OLE. However, its not nearly too high-level to be of use to programmers starting to tackle these subjects. I have to confess that OLE only makes up the last third of the book, and that is the part that got nearly all my attention. That last one-third turned out to be well worth the $29.95, though, and Ive since started reading a bit about CORBA as well.
Microsoft has done a spectacularly poor job of describing and selling the technical details of OLE to programmers. This book provides what programmers lack a what-it-all-means perspective you can only get from folks who are familiar with both OLE and design alternatives (e.g., CORBA), and who can communicate well. This book does not provide you with any code, but it descends all the way to describing the basics of some of the core interfaces in OLE. In fact, when I have to use an OLE interface Im not familiar with, I now turn first to this book to get the high-level picture. Im not sure but what this book might be the best general introduction to OLE for programmers.
I should point out that Microsoft would probably argue that the authors of this book are biased against OLE. The authors clearly think much of CORBA is better designed than OLE, and the interspersed soapbox sidebars tend to get a bit louder in the OLE section ([monikers are] a marketing term for adding fixes to the system and making them sound impressive). I found this lets get real attitude a welcome relief from the relentless boosterism of Kraig Brockshmidts Inside OLE 2. Biased or not, the authors got me closer to understanding OLE monikers than any other book Ive plowed through.
There is a problem with this book. OLE underwent significant changes since this book was published (least of which was a name change its now called ActiveX, or maybe just some parts of it are, Im not sure). I dont think these changes render much of the information here incorrect, but some of them do address at least a couple of the critiques offered by the authors. If a new edition of this book arrives that covers the more recent OLE developments, I will be first in line to buy it. In the meantime, if youve picked up a number of OLE programming books and put them down again without any noticeable increase in understanding, try giving this book a read. It wont tell you how to pound out the code, but it will help you understand the what and why of the code youll need to write.
And Keep in Mind
About Face: The Essentials of User Interface Design
by Alan Cooper, IDG Books, 580 pages, $29.99, ISBN 1-56884-322-4. Reviewed February 1997.
Reviewed in the February, 1997 Windows Developers Journal. One of the few books on user interface design to choose its examples from common Windows applications. A high-level discourse about how user interfaces do, dont, and ought to work.
Delphi 2 Unleashed
by Charles Calvert, 1,372 pages, $59.99, includes CD, 2nd edition, Sams Publishing, 1996, ISBN 0-672-30858-4. Reviewed October 1996.This large, general book on Delphi (aimed at intermediate and advanced programmers) covers many topics: Object Pascal and OOP; Win32 multitasking, threads and memory management; exception handling; database programming at all levels; writing components, DLLs and CGI applications; OLE and COM; the Games SDK; message handlers and crackers; the command-line compiler; multimedia programming and much more. Two guest authors contribute material on writing Web applications and ReportSmith. There are remarkably few errors, inaccuracies, and typos. Although wordy and repetitious, it is one of the two best general books on Delphi. The CD contains 15 additional chapters of more basic material.
Books Received
de Champeaux. Object-Oriented Development Process and Metrics. Prentice-Hall. 470 pages. $45.00. ISBN 0-13-099755-2. Tackles the problem of making O-O development predictable and reproducible.
Goggin, Schindler, Taylor, and Telles. IntraBuilder FrontRunner. Coriolis Group Books. 416 pages. $29.99. ISBN 1-57610-102-9. An introduction to Borlands tools for building database-driven intranet sites. Nearly one full paragraph per page. I feel a Coriolis-induced haiku coming on: A sea of white space / lonely specks of text float by / still the forest weeps.
Harmon. Web Developers Guide to Visual J++ & ActiveX. Coriolis Group Books. 432 pages. $39.99 (includes CD-ROM). ISBN 1-57610-062-6. An airy introduction to Microsofts Java compiler/environment. Plenty of room in the margins for notes.
Spuler. C++ & C Tools, Utilities, Libraries, and Resources. Prentice-Hall. 400 pages. $49.95 (includes CD-ROM). ISBN 0-13-226697-0. A large roundup of free and commercial tools for C/C++ programmers; best feature is frank author comments about the tools he has experience with.
Tkach, Fang, and So. Visual Modeling Technique. Addison-Wesley. 426 pages. $46.50. ISBN 0-8053-2574-3. How to build software with the visual programming paradigm built into IBMs VisualAge series of language products.
Wiegers. Create a Software Engineering Culture. Dorset House Publishing. 358 pages. $39.95. ISBN 0-932633-33-1. A people-centered approach to producing better software.
Wixon and Ramey. Field Methods Casebook for Software Design. Wiley. 342 pages. $49.95. ISBN 0-471-14967-5. Seventeen separate papers related to field research the process of going to where your users live and trying to discover what kind of software would really make their work easier.
Got an opinion about these or other programming books? Send it to [email protected]. Go to www.wd-mag.com/vendor/ to learn how to submit a book review.