Preface

From 1992 to 1997, 95% of my development was done in Visual Basic, and about 5% of my development involved writing components for Visual Basic using the Microsoft Foundation Classes (MFC) in C++. Then, in 1998, I received an offer from a company to develop a set of COM components using a class library called the ActiveX Template Library (ATL) exclusively in C++. At the time I took the position, I thought I knew COM fairly well, and although I knew the C++ side of development would be a little difficult, I was convinced that within a few months I would be able to master it. Boy, was I in for a big surprise! After a few days, I realized that I knew very little about COM. In fact, I learned that, in many ways, Visual Basic shields us from knowing about COM. Part of me thought, “That’s what VB is for—to hide you from the details of the technology so that you can be more productive.”

After a few months at the job, I realized that, although the goal of Visual Basic is to hide the architecture so that we can be more productive, it turns out that there are many times in Visual Basic development when the technology sneaks out from under the covers. Once in a while, you will see options like DLL Base Address or Threading Model and wonder, “Should I turn that on?” “Should I change that number?” “What exactly does that mean?” The most frustrating thing is being faced with the technology and not knowing how to solve a simple problem only because VB has done such a good job at hiding things in the past. I also realized that had I known how things worked internally in the architecture, I would have done things completely differently on occasion. From then on, I was on a crusade to learn! I wanted to learn exactly how things worked not only in the component architecture but also at the operating system level.

Later, COM+ was released. Once again, Microsoft made it extremely easy for us to take COM components and make them part of a COM+ application and apply services to them. But then I would hear things like, “Make sure not to add all your components to it” or “Make sure not to turn on transactions for your components if you are using only one database.” It is extremely frustrating to have to deal with the technology and be told not to do this and to do that and not really know what you are supposed to do. I found that learning the guts of the technology may be hard at first but that it makes it significantly easier later to make decisions about design, coding, and deployment.

Later this year, you are going to see a brand new component architecture from Microsoft called .NET. You may be wondering how .NET is going to change things for COM+. .NET is a completely new architecture resembling COM+ very little. However, let me assure you that COM+ is not going away any time soon. In fact, the Windows 2000 operating system is heavily dependent on COM+. What’s more, it is going to be a while before the COM+ services work natively with .NET. But I do not want to sound like a salesperson here! Instead, I would like to tell you what I believe will happen next year to us VB developers.

My current job is teaching COM+ and Visual Basic .NET to different companies. When I teach Visual Basic .NET, students often come to me and say, “But what has happened to Visual Basic—it no longer hides any of the internals.” Visual Basic .NET is a brand new language. It is going to radically change the expectations of VB developers. In many ways, the things you will have to know about the runtime and about the way the architecture works will be the same things that C++ developers programming in C# will have to know. By the end of next year, if Microsoft is successful with its deployment of .NET and your company adopts it, your programming job will be very different. It is my opinion that you should start learning things now. This book will help you with both the COM+ side and the transition to .NET.

What I have tried to do in this book is not to teach you every detail about COM+ services. My goal was rather to teach you how the architecture works. The services are arguably the icing on the cake. For example, this book does not cover COM+ events. Some of you may ask, “Why not?” Well, the services in COM+ may come and go; what’s important for you to learn is how the architecture works internally. Then, you will be able to quickly figure out any of the services. I felt that it would be best to cover the services that have the biggest impact in your life: transactions and security. The rest of the COM+ coverage in the book focuses on how Microsoft is able to provide you with the services in the first place and how to interact with the environment.

Who This Book Is For

I often joke with my colleagues that the target audience for this book is VB developers who are tired of hearing that C++ developers know more than they do. If you are tired of not knowing how the technology works and why VB does things the way it does and if you are tired of wondering when to turn on this switch as opposed to this other switch, this book is for you.

Now, I felt compelled to tell you up front who this book is not for. If you are looking for a book that just tells you the basics of the technology with practical code that you can plug into your application and with the idea that you will learn how to create a three-tier database application, unfortunately, this book is not for you.

You do not have to be an advanced VB developer to pick up this book, but you do have to have the mindset that this book is about the guts of the technology. I want to stress that the sample code in this book is meant to illustrate how the architecture works and sometimes to stretch VB’s capabilities. If you miss books like Hardcore Visual Basic, by Bruce McKinney, this book is for you.

This book is also for you if you are interested in learning the guts of .NET for VB developers. Granted, it is very difficult to explain everything about .NET in one chapter, but I believe the information in that last chapter will give you an appreciation for how the technology has changed internally and how beneficial the changes are.

Get COM+ Programming with Visual Basic now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.