Real World Programming for OS/2 2.1 Book Review

Review by Carsten Whimster

Introduction
The Codesmith Library column is a new monthly column which will focus on development oriented books and material. This will mostly consist of programming books, such as this month's Real World Programming for OS/2 2.1, but could also cover books like The Design of OS/2. The column will be from a beginning PM programmer's eyes (because that's what I am), and hopefully that is most useful to the community in general. As I get on with the column, however, I expect to get better, and so within a year or so, I will (presumably) qualify as an intermediate programmer, or perhaps even somewhat of an expert. Hopefully you, the readers, will move with me in that respect. When reading this column, try to pick up whichever book strikes your fancy, and join the group of people following our introductory PM programming columns. I will try to review books aimed at beginners to start with, and then move on from there.

The column will largely be demand-oriented (after I get my own books out of the way early on), so if you have a book you would like reviewed, send me e-mail and tell me about it, or even better, send me the book (sorry, no returns). Finally, please send me your comments and thoughts so that I can make this column as effective as possible. After all, this is our magazine.

This month's selection was chosen because it is the one of my books I like best. It was recommended to me on CompuServe, and has a good reputation as a beginner's PM programming book.

Review
Real World Programming for OS/2 2.1 is a fairly hefty book at no less than 868 pages! It is aimed at (it says here, on the back) intermediate to advanced (users or programmers?), and is meant as a PM programming how-to book. It comes with a 3.5" diskette with all the source code from the book. It even has its own installation program, and a very nice one at that. The authors encourage you to use the source code from the book in your own programs, although they do insist that enough modifications should have been made to make the code basically your own work.

After installing the sample code, it is recommended that you set or check the COMPILER, PATH, INCLUDE, and LIBPATH environment variables. I also found it necessary to set the LIB environment variable. Makefiles are included for IBM C Set, Borland C++, Watcom C/C++, Zortech C++, and Microsoft's C compiler. Once the environment variables are set properly, each of the sample apps can be recompiled in their own sub-directory by a file called GO.CMD, in case you should want to try your own modifications to the sample code (which is recommended by the authors.)

To familiarize you a little with the book, I have included the titles of the chapters here: I haven't read every chapter of course, but I have used material from a surprising number of them. The authors recommend that you read chapters one through four, and then go on to whatever chapters interest you, but I only made it through the first three before curiosity and need took me elsewhere. All the chapters have an introduction explaining the importance of the material before launching into the code example. Each chapter has a sample program to demonstrate the use of the various APIs involved, as well as showing a possible application for these calls. Code from these sample programs is introduced in the text of each chapter, and at or near the end of each chapter the full source code is presented.
 * 1) Programming for OS/2
 * 2) OS/2 Application Window Fundamentals
 * 3) Window Management
 * 4) 2.1 Common Dialogs
 * 5) Menus
 * 6) Presentation Spaces and Drawing
 * 7) Creating and Manipulating PM Fonts and Text
 * 8) Profile Management
 * 9) Memory Management
 * 10) Dynamic Link Libraries
 * 11) Printing
 * 12) Threads and Semaphores
 * 13) Calling 16-Bit Code
 * 14) Communication Basics
 * 15) Miscellaneous Topics

Although this book is large, it is not a complete coverage of the API, nor is it meant as such. It is intended to get the reader started into various important intermediate areas, and to expose what the authors consider the more useful function calls. The book is sometimes a little sparse in its coverage of some of the relevant data structures, but this is usually easily rectified by cross-referencing with the IBM toolkit reference material.

Due to the vast nature of the complete OS/2 API, there are (and must be) areas of interest which the authors for whatever reason, have decided to treat lightly, or skip altogether. Unfortunately, the application I was working on uses several features of the API which aren't covered well in the book. This necessitated a lot of foot-work which might have been avoided otherwise. For example, the TRACKINFO structure used to control frame windows is mentioned only once, and briefly at that. I also found it difficult to extract the correct information about pop-up menus from the complicated examples to build my own fairly simple pop-up, but eventually I did succeed. Frequently, I found that the sample code had a large number of intricately woven features which made it quite tricky to pull out just the necessary bits. In spite of having a good reputation for beginners, it probably is better off targeted at developers who have used the PM API for a few months already, and who consequently have the necessary understanding of the way things work to extract the needed parts, all the needed parts, and nothing but the needed parts from the sample code.

Another small, but noticeable flaw is the index at the back. It has most, if not all of the actual API names and data structures, but when you don't know the name of what you are looking for (which presumably will happen frequently, otherwise use the reference material instead of a programming book,) it can be a tedious job trying to imagine what the name of a certain call or data structure might be. Unfortunately this is quite common among books, and programming books in particular, and is not just a fault with this book.

Despite these minor concerns, the book remains a favorite of mine, and I use it frequently. The lucid writing, the good organization, and the depth of the material make it enjoyable most of the time. I recommend this book to anyone willing to dig a little, and who wants something a little more than an introductory book, with useful sample code, and a great breadth of coverage.

Summary
This book is a good buy overall, although it is a little lacking in some areas. It was recommended to me as a beginning PM programmer's book, but I see it as being a little too complex for that, unless you have experience in programming some other GUI. The skeleton program is good, but separating out the code you need from the more advanced examples can be tedious and difficult. Had the pace of chapters two and three been more leisurely, I would have picked up a lot more, and felt a lot more at ease with it. As it was, I found myself constantly picking it up, putting it down, looking elsewhere for simpler examples, and then picking it up again to give it another try. If I had a bit of PM, X, Mac or Windows programming background, this book would have been perfect.

The example programs in the chapters are very good, though, and as the authors like to say, much more than just the normal do-nothing programs that many books have. The INITOR application actually made it into my \BIN directory with my other utilities, and most of the other programs were interesting at the very least. Intermediate or experienced PM programmers should love it.

Real World Programming for OS/2 2.1, Blain, Delimon, and English
 * SAMS Publishing, ISBN 0-672-30300-0. US $40, CAN $50
 * Intended audience: Intermediate to Advanced PM C programmers
 * Mark: B+