Standards

Standards are absolutely essential for the success of large, multi-developer projects. We will review three distinct areas in which we have defined standards for our developers to adhere to: naming, programming and GUI design. Again, the effort involved here isn't so much difficult, but it does require some up-front investment (mainly of time) to put it into place. Once you have a well-defined set of standards in place, you will realize benefits in the following areas:

In this section we'll present a guide to defining your own standards in these important areas. As elsewhere in the presentation, our focus will be on how these standards are adapted to the Visual Basic world. We don't have time to present a complete standards document, but we'll try to present enough concrete examples to get you started.

Naming

In Appendix A we include a summary of a naming approach that has worked well for us. For now, we'll provide some general guidelines and then review some of the areas you will want to define a set of naming standards to cover.

General Guidelines

In general, our naming conventions obey the de facto standard construct:

<prefix><Mnemonic>

The <prefix> portion identifies the technical nature of the thing being named: what type of control it is, what data type a variable is, the scope of a variable, the type of object a variable points to, and so on. The <Mnemonic> portion identifies the business role the thing plays, or the function it performs.

You should have well-defined naming conventions for at least the following areas:

GUI Design

Having standards in place for graphical user interface (GUI) design should be as non-controversial as for naming or programming. With the newness of the Windows operating system environment and the recent "down-sizing of America," this does seem to be an area that lags behind the more "technical" areas in terms of standards implementation. Custom corporate applications have a particular set of interface issues that developer workgroups should define standards for; many of these issues are not discussed in the standard references (for example, The Windows Interface: An Application Design Guide, Microsoft Press®, 1992 is essentially written as a guide for commercial application developers). We don't have time in this presentation to provide a complete guide to GUI design; rather, we'll present an overview of the areas you should have standards in place for, and give what we feel are some of the "greatest hits" of required GUI design standards.

General Issues

Table 1: Proper font usage for custom applications

Text

Font

Title bars, menu text

Windows System font (10 point Sans Serif)

Control labels and captions

8 point bold Sans Serif

Data entry fields

8 point non-bold Sans Serif

Status bar text

10 point non-bold Sans Serif

Icon text

8 point non-bold Sans Serif


Windows and Dialogs

Tip: MDI Applications. Even though child windows, according to the standard references, should be completely sizable, we've found a slight departure from this works best in custom application work. Since many data windows present fixed fields and controls on the form, make these MDI child windows fixed in size and not maximizable. Give them these property settings:

BorderStyle

1 - Fixed Single

MinButton

True

MaxButton

False


Tip: Reusable Interface Components. Better yet, create template forms for your MDI parent and child forms. Even though Visual Basic doesn't have the concept, as does Access, of a "normal" form on which default properties can be based, we've found that template forms can be used to much the same purpose. For example, template forms can be created with fairly extensive menu systems, both to demonstrate to your developers what your standard menus are for MDI parent and child forms, and to save them the time of having to create them over and over again. We keep our template forms in a shared project called GLOBALS.MAK. This not only contains re-usable interface components, but also our standard modules of generic procedures, global and constant declarations and so forth.

Menus

Tip: Copying and Pasting Menus. Always remember to save your Visual Basic forms as text files (make sure the "Save as Text" checkbox is selected in the "Save File As" dialog). If you do, you can reuse interface components such as menus, even if you don't implement the complete forms-template approach we discussed above. You can do this by loading the form definition .FRM file for any of the forms in your application, copying the menu definition portion of the file to the clipboard, and pasting it into the proper location in a "target" form requiring the same menus. For example, Listing 1 shows the definition of a "Records" menu that could make sense in any table-based form.

Listing 1: Menu Definition Section of a .FRM File


Begin Menu mnuRecords 
      Caption         =   "&Records"
      Begin Menu mnuRecordsGoto 
         Caption         =   "&Go To"
         Begin Menu mnuRecordsGotoFirst 
            Caption         =   "&First"
         End
         Begin Menu mnuRecordsGotoLast 
            Caption         =   "&Last"
         End
         Begin Menu mnuRecordsGotoNext 
            Caption         =   "&Next"
         End
         Begin Menu mnuRecordsGotoPrevious 
            Caption         =   "&Previous"
         End
      End
      Begin Menu mnuRecordsSep1 
         Caption         =   "-"
      End
      Begin Menu mnuRecordsSort 
         Caption         =   "&Sort..."
      End
      Begin Menu mnuRecordsFind 
         Caption         =   "&Find..."
         Shortcut        =   ^F
      End
      Begin Menu mnuRecordsSep2 
         Caption         =   "-"
      End
      Begin Menu mnuRecordsAdd 
         Caption         =   "&Add"
         Shortcut        =   ^A
      End
      Begin Menu mnuRecordsDelete 
         Caption         =   "&Delete..."
      End
      Begin Menu mnuRecordsSave 
         Caption         =   "&Save"
         Shortcut        =   ^S
      End
   End
Custom Controls and Add-Ons in Visual Basic

Given the popularity of .VBX custom controls and add-on tools, you really have to define a standard toolset for your Visual Basic development teams. If you don't, your applications will not have a consistent look and feel, and your developers will continually be wasting time learning the latest cool tool. Without recommending any specific tools, here are the categories of add-ons our we've defined standards for: