Developer

Book review: Microsoft Visual Basic Design Patterns

Contributing author Lamont Adams is reluctant to let go of his review copy of Microsoft Visual Basic Design Patterns. See why he considers it the most relevant book for object-oriented programming in Visual Basic on the market today.

First off, let me say that I think my editor is mad at me. Why? Because I was given a copy of Microsoft Visual Basic Design Patterns (William Stamatakis, Microsoft Press, $49.99) to review some time ago, and I have not given it back. After reading the book cover to cover, the propeller-head in me would like to share the following opinion: This is the most relevant book on object-oriented programming in Visual Basic that I have ever seen, period. I will not be giving up my already dog-eared copy without a fight.

Visual Basic Design Patterns is aimed at advanced programmers looking to get the most out of Visual Basic’s object-oriented programming features. The book discusses a set of design patterns that a programmer can use in his or her applications. What is a design pattern? A concept borrowed from C++ and other “real” object-oriented languages, a design pattern is a blueprint for solving a problem in an object-oriented fashion that provides an emphasis on reusability, extensibility, and elegance. These are not code snippets by any means—each pattern illustrates a design for a solution to a frequently occurring problem. The implementation, the actual writing of those snippets, is left entirely up to the reader.

Design Patterns is more a design manual than a programming guide. Stamatakis does an excellent job of adapting this design approach to Visual Basic, given that the language has only partial object-oriented support. He discusses abstract and highly technical concepts lucidly and displays a mastery of the vagaries of object-oriented design using Visual Basic.

Three steps to success
The book consists of three sections. The first section, “Object Basics,” provides some background information, discussing basic object-oriented terms and concepts and explaining how these concepts apply to Visual Basic. It also looks at common approaches, misconceptions, and pitfalls and offers an under-the-hood discussion of how Component Object Modeling (COM) operates. (COM is the architecture upon which Visual Basic’s object-oriented tools are constructed.) This part of the book covers topics such as threading, memory management, and cross-process communication. Although the information in this discussion is useful, understanding it is not essential to understanding the examples in the rest of the text.

The bulk of the book’s content is found in the second section, “Design Patterns.” It includes 10 design patterns, complete with specific examples of usage, diagrams in a variety of notations (all explained in the first appendix), implementation details, drawbacks, and potential problems for each blueprint. Among the patterns covered are:
  • Adaptor—A standard approach to making legacy systems accessible to an object-oriented system
  • Repository—A storehouse of object state information
  • Smart Proxy—A distributed communications manager

Each pattern ranges from 10 to 20 pages. Code samples, along with a sample implementation of each pattern, are included on an accompanying CD-ROM.

The final section of the book offers two appendices, a primer of sorts on different methods of object diagramming used in the book and a discussion of interface inheritance in COM and VB. The latter covers topics such as the Implements keyword and the three compatibility settings for ActiveX projects.

Although not a tutorial for beginners, Microsoft Visual Basic Design Patterns includes enough background information to be useful as both a reference and how-to manual for programmers of all skill levels. Those who have a solid understanding of the language or are transferring skills from a “real” object-oriented language will get the most from this book. But because it is still possible, for better or for worse, to accomplish things in VB without using an object-oriented approach, Design Patterns may suffer from a rather small audience. Even so, I have never come across a better reference for object-oriented design in VB, and it will always have a place in my reference library. As long as my editor does not take it away when I am not looking.
0 comments

Editor's Picks