What Are We Trying to Accomplish?

The aim of this chapter is to teach you different methods of catching bugs during Visual Basic 6 program development and unit testing, before they can reach the master source files. As programmers, we are in a unique position. First, we can learn enough about bugs and their causes to eliminate large classes of them from our programs during initial development. Second, we are probably the only people who have sufficient knowledge of the internal workings of our programs to unit-test them effectively and thereby identify and remove many bugs before they ever reach our testers and users. Developers tend to be highly creative and imaginative people. The challenge is to impose a certain discipline on that talent in order to attack the bug infestation at its very source. Success in meeting this challenge will give us increased user confidence, fewer user support calls and complaints, shorter product development times, lower maintenance costs, shorter maintenance backlogs, and increased developer confidence—not to mention an ability to tamper with the reality of those developers who think that a zero-defect attitude to writing code is nonproductive.

A Guided Tour

In the first part of this chapter, we'll take a look at some of the more strategic issues involved in the high bug rate currently experienced by the IT industry. We'll also look at some of the latest ideas that leading software companies such as Microsoft and Borland use to tackle those issues. Although these ideas aren't all directly related to writing code, Visual Basic developers and their managers need to understand them and the issues behind them. As Visual Basic 6 becomes more and more the corporate tool of choice in the production of large-scale projects, we are faced with a challenge to produce complex, low-defect systems within reasonable schedules and budgets. Without a firm strategic base on which to build, the game will be lost even before we start designing and coding.

We'll also examine the role that management and developer attitudes play in helping to produce fewer bugs. One of the key ideas here is that most program bugs that reach production can be avoided by stressing the correct software development attitudes. Several studies have shown that programming teams are successful in meeting the targets they set, provided these targets are specific, nonambiguous, and appropriately weighted in importance for the project being tackled. The attitudes of developers are driven by these targets, and we'll look at ways of reinforcing the attitudes associated with low bug rates.

Then it will be time to get our hands dirty. You probably remember those medieval maps that used to mark large empty regions with the phrase "Here Be Dragons". We're going to aim for their Visual Basic 6 equivalent, boldly venturing into the regions labeled "Here Be Nasty Scaly Six-Legged Hairy Bugs" and looking at some issues directly related to Visual Basic design and coding. We'll see where some of the more notorious and ravenous bugs are sleeping and find out how we can avoid waking them—or at least how we can avoid becoming really tangled up in them. At this point, we'll sometimes have to delve into rather technical territory. This journey into technical details is unfortunately inevitable when peering at creatures worthy of some of H. R. Giger's worst creations. Once you come out on the other side unharmed, you should have a much better appreciation of when and where Visual Basic developers have to be careful.

In the final section of this chapter, we'll look at some tools that can aid the bug detection and prevention processes in several ways. Microsoft seems to have established a virtual monopoly on the term "Wizard" to describe an add-in or utility designed to help programmers with some aspect of code development. So casting around for a suitable synonym, I came up with "Sourcerer" (thanks, Don!) instead, or perhaps Sourceress. Three such tools are demonstrated and explained.

The three sourcerers

The first tool is the Assertion Sourcerer, an add-in that supplements Visual Basic 6's Debug.Assert statement and allows you to implement assertions even in compiled modules, ideal for testing distributed components. Next comes the Metrics Sourcerer, also an add-in. It uses a couple of fairly simple measurements to estimate the relative complexity of your Visual Basic 6 project's procedures, forms, and classes. Several studies have shown that the longer and more complex a procedure, the more likely it is to have bugs discovered in it after being released to production. The final utility is the Instrumentation Sourcerer, yet another add-in. It adds instrumentation code to your Visual Basic 6 project to track all user interactions with your application's graphical interface. This tool can be invaluable in both tracking a user's actions leading up to that elusive program bug and showing exactly how different users use your application in the real world.

"Some final thoughts" sections

Throughout this chapter, many sections end with a recommendation (entitled "Some Final Thoughts") culled from both my own experiences and those of many other people in the IT industry. Acting on these suggestions is probably less important than understanding the issues behind them, as discussed in each section. These recommendations are just opinions, candidly stated, with no reading between the lines required.



Ltd Mandelbrot Set International Advanced Microsoft Visual Basics 6. 0
Advanced Microsoft Visual Basic (Mps)
ISBN: 1572318937
EAN: 2147483647
Year: 1997
Pages: 168

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net