WindowsDevCenter.com
oreilly.comSafari Books Online.Conferences.

advertisement


AddThis Social Bookmark Button


Paul Lomax is the author of Learning VBScript and VB & VBA in a Nutshell: The Language. He has been a programmer for over 12 years and has been a dedicated fan of Visual Basic since version 1. Paul is the technical director of Mentorweb, a leading Web design and hosting company, and over the past two years he has created and maintained over 60 commercial Web sites for Mentorweb's clients.

O'Reilly Editorial Assistant Tara McGoldrick began this interview by asking Paul what led him to write VB & VBA in a Nutshell: The Language?

Lomax: As we were finishing up Learning VBScript, my first book for O'Reilly, my editor, Ron Petrusha, asked if I'd be interested in writing another book. To be honest, I'd spent so much time writing Learning VBScript that I wasn't going to write another book, but, before I knew it, I agreed to write a book about the VBA language! I think it was simply the challenge of such an enormous task that appealed to me -- to completely document every function and statement in the VBA language. I actually started the book in July or August '97, so it took just over a year to write.

McGoldrick: Tell us about your programming background.

Lomax: The first program I ever wrote (and I still remember it!) was in BASIC on a Commodore 64. Sometime after that I wound up writing large database applications for commercial organizations in the UK using XDB. I was reacquainted with BASIC via GW-Basic, and that's when my enthusiasm for BASIC really took hold. By the time VB1 for DOS was launched, I was completely hooked! Apart from a couple of apps I've written using the first version of Delphi, I've been a VB'er ever since. In January of this year, I was fortunate enough to be invited to Redmond at the start of the VB6 beta program, which came in handy to make sure that the book was bang up-to-date when it was released.

McGoldrick: After having been to Redmond, what do you think Microsoft's vision for VB is, and how does VB fit into their Web strategy?

Lomax: When the beta of Visual Studio (Aspen) was released, it was widely known as Visual Studio 98. All the components within VS were to take the '98 tag. However, by the time we got to Redmond for the Technical Summit it had been decided to use the next VB number (6) for the new release of Visual Studio and all its component parts, even if that meant skipping a few Numbers, as in the case of Visual Interdev. While this numbering of products may appear to be of minor consequence, it shows that the VB team (contrary to previously held beliefs) do have an increasing amount of power within Microsoft, and it shows the seriousness with which Microsoft takes the marketing of VB.

During my visit it was made quite clear on several occasions that C++ is the recommended tool for system development and that VB is the recommended tool for corporate application development. In fact I don't know whether you're aware that for the first time Microsoft has used VB themseleves to create parts of VS6.

Microsoft's web strategy (at least to me) is quite clear: Focus on where the money is. By this I mean corporate development. Simply concentrate on those areas where people are willing to pay to have applications developed. They now have a formidable range of tools to create the very finest web-based applications. NT, IIS and MTS as the platform, with Visual Interdev and VB to both create and manage the components and scripts.

To me, VB plays a key role in that it can be used to create complex downloadable controls. It can be used to create DLL's that can be called from an Active Server Page, and VBScript is the main language to use with Active Server Pages. Sure, I was disappointed when VBScript wasn't more widely accepted for web page scripting, but, as a developer, there isn't any money in web page scripts anyhow!

McGoldrick: It's claimed that Perl is the glue of the Internet. It's been used to create huge sites like Yahoo! and amazon.com. How do you think VB stacks up against Perl?

Lomax: Oh, no! You're asking the wrong person about Perl! I know I'm in Perl country here at O'Reilly, but I really never did like using Perl. I always use PHP3 for any UNIX Web scripting I have to do. The only time I write Perl scripts is to work with system stuff on some of my UNIX web servers, like zone files or httpd configs and the like.

Comparing VB and Perl isn't easy. In many ways they're two different things. You couldn't, for example, use Perl to create a DLL to run within transaction server. And the VB language is much easier for developers to learn, use and read, whatever their background. Of course, Perl is a very important language within a UNIX system environment, and you can draw a parallel to how VBScript will be used to script system level stuff when NT5 comes out. Then you've got to remember that VB has a development environment. And, if you're using VBScript on the server side, you can use Visual Interdev, which now includes a complete runtime debugging environment. This will save web developers hours. Compare that to using a text editor and a log file!

McGoldrick: Did you find any parts of this book difficult to write?

Lomax: Chapter 7, The Language Reference, was a tough one! It takes up about 80% of the book. The bulk of the reference section consists of programming tips and gotchas, which I really enjoyed writing. I think that they form the real value of the book. But it's not really possible to just include a collection of programming tips and gotchas for each language element and imagine that you've written a comprehensive book. Since VB & VBA in a Nutshell is intended to be a reference work, this means that, for the sake of completeness, there's no way to avoid the rules and syntax sections; and these were a complete nightmare for me. Why? Well, the rules and syntax have a much more formal style, so they tend to be dry. With any technical subject where you have to use conventions and terminology that will be understood by the reader, you're completely limited in how you can say something. I tried to inject some life into these more formal sections, and in a few cases I think that I even may have succeeded. I'm glad I did!

McGoldrick: What's your favorite part of the book?

Lomax: The Tips and Gotchas are where the golden nuggets, the gems of this book, are found. The Tips and Gotchas come straight out of the heart; they're the things I've learned the hard way, struggled with and sweated over throughout my many years using VB. I also was able to write these in a much more informal style, as though as I was simply talking to someone. Without exception, the colleagues and programming friends to whom I have shown the drafts have all found lots of ideas, tidbits, and valuable information in the Tips and Gotchas. For example, when a professional VB developer finds out something they didn't know about the MsgBox function, you know you've done a good job!

McGoldrick: What are the biggest problems developers face when working with the core VB/VBA language?

Lomax: Information, or the lack thereof! The help section and documentation that comes with VB can, by its very nature, only go so far. You have to bear in mind that the majority of help topics were written before the particular language element went into general use. Not only that, but they were written by technical writers, not developers. So, as a professional developer, you can hit upon a problem or want to know something deeper about a function and you hit a brick wall. All the help section tells you is what you probably already know! That's where my experience of using VB day in and day out for more years than I want to remember is going to pay off. As a developer, can you, your company, or your client afford you to mess about trying out different things? Probably not these days!

McGoldrick: The body of information that programmers need to master seems to be increasing geometrically. Over the next few years, how do you see the kinds of information that developers need (and particularly the kinds of information that you've written about in your O'Reilly books) changing?

Lomax: What I'm seeing is that developers are tending to specialize. Whereas a few years ago a VB application could be written from start to finish by one person, it now demands such a wide variety of skills that organizations find it more efficient to split the job up into its component parts. Therefore, I see a pressing need for a highly focused series of books, each covering a particular part of VB programming in great depth; as opposed to the very large volumes that try to teach someone everything, and in doing so they are forced to skim over important concepts.

Another twist is that many new VB developers are actually coming into VB from another language like C++. These are experienced programmers who, for example, are familiar with the concept of a For loop, so they don't want to be led by the hand or have someone insult their intelligence by treating them like a dummy! They may only want to know how a For...Next loop is constructed in VB. Which, I suppose, really is the essence of the Nutshell series and the line we've followed with this book.

McGoldrick: Besides your writing for O'Reilly, have you done any other writing, technical or otherwise?

Lomax: Yes, my first book, which was about VBScript and ActiveX, was published by Sams as part of Laura Lemay's Web Workshop series. I've also had articles published in Dr. Dobbs Journal and VB Advisor. I'm still waiting for some top Hollywood producer to turn one of my books into a film, though... maybe I'll have a long wait!

McGoldrick: If you had the opportunity to ask Microsoft to change one thing about Visual Basic, what would it be?

Lomax: I've a surprising short wish list, really. Just one you say? Hmmm... The built in registry functions are showing their age, especially since so many VB apps are now being used in an NT environment. The way things currently stand -- because you're restricted in where you can place your custom registry settings -- you have to reset them all when a new user logs on. Of course, you can work around it with the Windows API, but that's not what VB is about!

McGoldrick: Are you working on another O'Reilly book now?

Lomax: Three others! I think Ron (my editor) is afraid that I might get bored! The first one is about creating Microsoft Transaction Server components with VB, the other two are creating custom controls and creating Data Classes. I think there'll be more to come after these, too!