Visual Basic

Programming on Purpose

It's a popular myth that Microsoft Visual Basic has changed programming. I disagree. Programming is as hard as it always was-most people who say that Visual Basic projects are easy just aren't doing them right. Perhaps Visual Basic has advanced the state of the art of Microsoft Windows programming a notch or two; but behind the form designers and the wizards lies procedural code, with all the traditional problems developers have come to expect.

A dangerous side effect of making a programming tool as easy to use as Visual Basic is the illusion that this somehow dispenses with the need for detailed design-that the code somehow writes itself. The truth, scribbled in the margin of many a project postmortem report, is that programming in Visual Basic is programming first and Visual Basic second.

This chapter is about detailed design. To illustrate the kinds of things you need to think about when designing an application, we'll be looking at the design and construction of a window-management scheme, perhaps the most fundamental part of any Windows program. You'll be reading a lot about the graphical user interface (GUI), but you won't be seeing anything about button sizes, mouse-pointer psychology, or the choice of fonts and colors-the approach in this chapter is from a different angle, addressing the kinds of problems that will sink a GUI no matter how nice the screens look. You'll be seeing the choices Visual Basic offers for designing window-management schemes, some of the obstacles Visual Basic puts in your way, and how you can use some of the more advanced features of Visual Basic to get what you want. In all of this, you'll be focusing on two particular areas: how to use classes to build value-added forms, and how to manage complexity with finite state machines.

by BrainBellupdated
Advertisement: